Skip to content

Commit dce7d4a

Browse files
committed
GPU OpenCL: Add .oclCompileFromSources option to force OpenCL compilation from sources
1 parent 5b55339 commit dce7d4a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ int32_t GPUReconstructionOCL2Backend::GetOCLPrograms()
6464
const char* ocl_flags = GPUCA_M_STR(OCL_FLAGS);
6565

6666
#ifdef OPENCL2_ENABLED_SPIRV // clang-format off
67-
if (ver >= 2.2f) {
68-
GPUInfo("Reading OpenCL program from SPIR-V IL (Platform version %f)", ver);
67+
if (ver >= 2.2f && !GetProcessingSettings().oclCompileFromSources) {
68+
GPUInfo("Reading OpenCL program from SPIR-V IL (Platform version %4.2f)", ver);
6969
mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCL2Code_spirv_start, _binary_GPUReconstructionOCL2Code_spirv_len, &ocl_error);
7070
ocl_flags = "";
7171
} else
7272
#endif // clang-format on
7373
{
74-
GPUInfo("Compiling OpenCL program from sources (Platform version %f, %s)", ver);
74+
GPUInfo("Compiling OpenCL program from sources (Platform version %4.2f)", ver);
7575
size_t program_sizes[1] = {_binary_GPUReconstructionOCL2Code_src_len};
7676
char* programs_sources[1] = {_binary_GPUReconstructionOCL2Code_src_start};
7777
mInternals->program = clCreateProgramWithSource(mInternals->context, (cl_uint)1, (const char**)&programs_sources, program_sizes, &ocl_error);

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ AddHelp("help", 'h')
218218
EndConfig()
219219

220220
BeginSubConfig(GPUSettingsProcessing, proc, configStandalone, "PROC", 0, "Processing settings", proc)
221-
AddOption(platformNum, int32_t, -1, "", 0, "Platform to use, in case the backend provides multiple platforms (-1 = auto-select)")
221+
AddOption(platformNum, int32_t, -1, "", 0, "Platform to use, in case the backend provides multiple platforms (OpenCL only, -1 = auto-select)")
222222
AddOption(deviceNum, int32_t, -1, "gpuDevice", 0, "Set GPU device to use (-1: automatic, -2: for round-robin usage in timeslice-pipeline)")
223223
AddOption(gpuDeviceOnly, bool, false, "", 0, "Use only GPU as device (i.e. no CPU for OpenCL)")
224224
AddOption(globalInitMutex, bool, false, "", 0, "Use global mutex to synchronize initialization of multiple GPU instances")
@@ -291,6 +291,7 @@ AddOption(tpcApplyDebugClusterFilter, bool, false, "", 0, "Apply custom cluster
291291
AddOption(RTCcacheFolder, std::string, "./rtccache/", "", 0, "Folder in which the cache file is stored")
292292
AddOption(RTCprependCommand, std::string, "", "", 0, "Prepend RTC compilation commands by this string")
293293
AddOption(RTCoverrideArchitecture, std::string, "", "", 0, "Override arhcitecture part of RTC compilation command line")
294+
AddOption(oclCompileFromSources, bool, false, "", 0, "Compile OpenCL binary from included source code instead of using included spirv code")
294295
AddOption(printSettings, bool, false, "", 0, "Print all settings when initializing")
295296
AddVariable(eventDisplay, GPUCA_NAMESPACE::gpu::GPUDisplayFrontendInterface*, nullptr)
296297
AddSubConfig(GPUSettingsProcessingRTC, rtc)

0 commit comments

Comments
 (0)