Cycles: compile opencl kernels in non-blocking thread, and don't crash on
build failure but show error message in status text.
This commit is contained in:
@@ -137,7 +137,6 @@ public:
|
||||
|
||||
CUDADevice(bool background_)
|
||||
{
|
||||
int major, minor;
|
||||
background = background_;
|
||||
|
||||
cuDevId = 0;
|
||||
@@ -153,11 +152,6 @@ public:
|
||||
else
|
||||
cuda_assert(cuGLCtxCreate(&cuContext, 0, cuDevice))
|
||||
|
||||
/* open module */
|
||||
cuDeviceComputeCapability(&major, &minor, cuDevId);
|
||||
string cubin = string_printf("lib/kernel_sm_%d%d.cubin", major, minor);
|
||||
cuda_assert(cuModuleLoad(&cuModule, path_get(cubin).c_str()))
|
||||
|
||||
cuda_pop_context();
|
||||
}
|
||||
|
||||
@@ -179,6 +173,27 @@ public:
|
||||
return string("CUDA ") + deviceName;
|
||||
}
|
||||
|
||||
|
||||
bool load_kernels()
|
||||
{
|
||||
CUresult result;
|
||||
int major, minor;
|
||||
|
||||
cuda_push_context();
|
||||
|
||||
/* open module */
|
||||
cuDeviceComputeCapability(&major, &minor, cuDevId);
|
||||
string cubin = path_get(string_printf("lib/kernel_sm_%d%d.cubin", major, minor));
|
||||
|
||||
result = cuModuleLoad(&cuModule, cubin.c_str());
|
||||
if(result != CUDA_SUCCESS)
|
||||
fprintf(stderr, "Failed loading CUDA kernel %s (%s).\n", cubin.c_str(), cuda_error_string(result));
|
||||
|
||||
cuda_pop_context();
|
||||
|
||||
return (result == CUDA_SUCCESS);
|
||||
}
|
||||
|
||||
void mem_alloc(device_memory& mem, MemoryType type)
|
||||
{
|
||||
cuda_push_context();
|
||||
@@ -231,7 +246,7 @@ public:
|
||||
|
||||
cuda_push_context();
|
||||
cuda_assert(cuModuleGetGlobal(&mem, &bytes, cuModule, name))
|
||||
assert(bytes == size);
|
||||
//assert(bytes == size);
|
||||
cuda_assert(cuMemcpyHtoD(mem, host, size))
|
||||
cuda_pop_context();
|
||||
}
|
||||
|
Reference in New Issue
Block a user