MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / BlockSizes

Class BlockSizes

src/library/generator.stockham.cpp:3147–3198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3145 }
3146
3147 class BlockSizes
3148 {
3149 public:
3150 enum ValType
3151 {
3152 BS_VT_WGS,
3153 BS_VT_BWD,
3154 BS_VT_LDS,
3155 };
3156
3157 static size_t BlockLdsSize(size_t N) { return GetValue(N, BS_VT_LDS); }
3158 static size_t BlockWidth(size_t N) { return GetValue(N, BS_VT_BWD); }
3159 static size_t BlockWorkGroupSize(size_t N) { return GetValue(N, BS_VT_WGS); }
3160
3161 private:
3162
3163 static size_t GetValue(size_t N, ValType vt)
3164 {
3165 size_t wgs; // preferred work group size
3166 size_t bwd; // block width to be used
3167 size_t lds; // LDS size to be used for the block
3168
3169
3170 KernelCoreSpecs<PR> kcs;
3171 size_t t_wgs, t_nt;
3172 kcs.GetWGSAndNT(N, t_wgs, t_nt);
3173
3174 switch(N)
3175 {
3176 case 256: bwd = 8/PrecisionWidth<PR>(); wgs = (bwd > t_nt) ? 256 : t_wgs; break;
3177 case 128: bwd = 8/PrecisionWidth<PR>(); wgs = (bwd > t_nt) ? 128 : t_wgs; break;
3178 case 64: bwd = 16/PrecisionWidth<PR>(); wgs = (bwd > t_nt) ? 128 : t_wgs; break;
3179 case 32: bwd = 32/PrecisionWidth<PR>(); wgs = (bwd > t_nt) ? 64 : t_wgs; break;
3180 case 16: bwd = 64/PrecisionWidth<PR>(); wgs = (bwd > t_nt) ? 64 : t_wgs; break;
3181 case 8: bwd = 128/PrecisionWidth<PR>(); wgs = (bwd > t_nt) ? 64 : t_wgs; break;
3182 default: assert(false);
3183 }
3184
3185 // block width cannot be less than numTrans, math in other parts of code depend on this assumption
3186 assert(bwd >= t_nt);
3187
3188 lds = N*bwd;
3189
3190 switch(vt)
3191 {
3192 case BS_VT_WGS: return wgs;
3193 case BS_VT_BWD: return bwd;
3194 case BS_VT_LDS: return lds;
3195 default: assert(false); return 0;
3196 }
3197 }
3198 };
3199
3200 void GenerateKernel(std::string &str, cl_device_id Dev_ID)
3201 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected