MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / compileModule

Function compileModule

src/backend/cuda/compile_module.cpp:153–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151namespace common {
152
153Module compileModule(const string &moduleKey, span<const string> sources,
154 span<const string> opts, span<const string> kInstances,
155 const bool sourceIsJIT) {
156 nvrtcProgram prog;
157 using namespace arrayfire::cuda;
158 if (sourceIsJIT) {
159 constexpr const char *header_names[] = {
160 "utility", "cuda_fp16.hpp", "cuda_fp16.h",
161 "vector_types.h", "vector_functions.h",
162 };
163 constexpr size_t numHeaders = extent<decltype(header_names)>::value;
164 array<const char *, numHeaders> headers = {
165 "", cuda_fp16_hpp, cuda_fp16_h, vector_types_h, vector_functions_h,
166 };
167 static_assert(headers.size() == numHeaders,
168 "headers array contains fewer sources than header_names");
169 NVRTC_CHECK(nvrtcCreateProgram(&prog, sources[0].c_str(),
170 moduleKey.c_str(), numHeaders,
171 headers.data(), header_names));
172 } else {
173 constexpr static const char *includeNames[] = {
174 "math.h", // DUMMY ENTRY TO SATISFY cuComplex_h inclusion
175 "stdbool.h", // DUMMY ENTRY TO SATISFY af/defines.h inclusion
176 "stdlib.h", // DUMMY ENTRY TO SATISFY af/defines.h inclusion
177 "vector_types.h", // DUMMY ENTRY TO SATISFY cuComplex_h inclusion
178 "utility", // DUMMY ENTRY TO SATISFY utility inclusion
179 "backend.hpp",
180 "cuComplex.h",
181 "jit.cuh",
182 "math.hpp",
183 "optypes.hpp",
184 "Param.hpp",
185 "shared.hpp",
186 "types.hpp",
187 "cuda_fp16.hpp",
188 "cuda_fp16.h",
189 "common/Binary.hpp",
190 "common/Transform.hpp",
191 "common/half.hpp",
192 "common/kernel_type.hpp",
193 "af/traits.hpp",
194 "interp.hpp",
195 "math_constants.h",
196 "af/defines.h",
197 "af/version.h",
198 "utility.hpp",
199 "assign_kernel_param.hpp",
200 "dims_param.hpp",
201 "common/internal_enums.hpp",
202 "minmax_op.hpp",
203 "vector_functions.h",
204 };
205
206 constexpr size_t numHeaders = extent<decltype(includeNames)>::value;
207 static const array<string, numHeaders> sourceStrings = {{
208 string(""), // DUMMY ENTRY TO SATISFY cuComplex_h inclusion
209 string(""), // DUMMY ENTRY TO SATISFY af/defines.h inclusion
210 string(""), // DUMMY ENTRY TO SATISFY af/defines.h inclusion

Callers 1

getKernelFunction · 0.50

Calls 13

getComputeCapabilityFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
makeTempFilenameFunction · 0.85
deterministicHashFunction · 0.85
renameFileFunction · 0.85
removeFileFunction · 0.85
addMethod · 0.80
writeMethod · 0.80
closeMethod · 0.80
getActiveDeviceIdFunction · 0.70
transformFunction · 0.70

Tested by

no test coverage detected