Class CpuExponentQuantizerPPP¶
Defined in File cpu_exponent_quantizer_ppp.h
Inheritance Relationships¶
Base Type¶
public switchml::PrePostProcessor(Class PrePostProcessor)
Class Documentation¶
-
class
switchml::CpuExponentQuantizerPPP: public switchml::PrePostProcessor¶ A class that implements the switchml exponent quantization scheme using CPU instructions.
Public Functions
-
CpuExponentQuantizerPPP(Config &config, WorkerTid worker_tid, Numel ltu_size, Numel batch_num_ltus)¶ Calls the super class constructor and initialize this class’s members.
- Parameters
config – [in] A reference to the context’s configuration.
worker_thread_id – [in] The worker thread that this prepostprocessor belongs to.
ltu_size – [in] The size in bytes of the logical transmission unit used by the backend.
batch_num_ltus – [in] How many LTUs constitute a batch.
-
~CpuExponentQuantizerPPP()¶ Calls CleanupJobSlice() to make sure that any dynamically allocated memory is released.
-
CpuExponentQuantizerPPP(CpuExponentQuantizerPPP const&) = delete¶
-
void
operator=(CpuExponentQuantizerPPP const&) = delete¶
-
CpuExponentQuantizerPPP(CpuExponentQuantizerPPP&&) = default¶
-
CpuExponentQuantizerPPP &
operator=(CpuExponentQuantizerPPP&&) = default¶
-
virtual uint64_t
SetupJobSlice(JobSlice *job_slice) override¶ Prepare the prepostprocessor’s internal variables for this job slice.
This must be called as soon as the worker thread receives a job slice.
- Parameters
job_slice – [in] A pointer to the job slice currently being worked on by the worker thread.
- Returns
uint64_t the number of transmission units that prepostprocessor will need to be sent and received by the backend.
-
virtual bool
NeedsExtraBatch() override¶ Check whether the currently running job slice needs an extra batch or not.
- Returns
true if the data type is float32
- Returns
false otherwise
-
virtual void
PreprocessSingle(uint64_t ltu_id, void *entries_ptr, void *exponent_ptr) override¶ Preprocess a tensor converting it to switchml’s representation and loading it into the backend’s buffers.
- Parameters
ltu_id – [in] The id of the logical transmission unit to be preprocessed within the current job slice. ltu_id will be used to compute the offset into the job slice ltu_id * ltu_size.
entries_ptr – [out] A pointer to where we will store the quantized payload.
exponent_ptr – [out] A pointer to where we will store the exponent in the packet.
-
virtual void
PostprocessSingle(uint64_t ltu_id, void *entries_ptr, void *exponent_ptr) override¶ Postprocess a tensor converting it to the client’s representation and loading it into the client’s buffers.
- Parameters
ltu_id – [in] The id of the logical transmission unit to be preprocessed within the current job slice. ltu_id will be used to compute the offset into the job slice ltu_id * ltu_size.
entries_ptr – [in] A pointer to where we will read the received payload from.
exponent_ptr – [in] A pointer to where we will read the exponent from.
-
virtual void
CleanupJobSlice() override¶ Cleans up all internal structures and release any dynamically allocated memory associated with the job slice.
-