Skip to content

Commit bef2f6b

Browse files
committed
Attempt to build from souce if build from binary fails
1 parent 1983aaf commit bef2f6b

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

src/library/blas/xgemm.cc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,32 @@ void makeGemmKernel(
176176
if (*kernelBinary) {
177177
#ifdef AUTOGEMM_PRINT_DEBUG
178178
printf("makeGemmKernel: pre-compiled binary found: %llu bytes\n", *kernelBinarySize);
179+
printf("makeGemmKernel: Creating program from binary\n");
179180
#endif
180181
clProgram = clCreateProgramWithBinary(
181182
clContext,
182183
1, &clDevice,
183184
kernelBinarySize, kernelBinary,
184185
&clBinaryStatus, &err );
185-
CL_CHECK(err)
186+
#ifdef AUTOGEMM_PRINT_DEBUG
187+
if (err != CL_SUCCESS) {
188+
printf("makeGemmKernel: Failed to create program with binary\n");
189+
}
190+
#endif
186191
err = clBuildProgram(
187192
clProgram,
188193
1, &clDevice,
189194
binaryBuildOptions, NULL, NULL );
190-
CL_CHECK(err)
191-
} else {
192195
#ifdef AUTOGEMM_PRINT_DEBUG
193-
printf("makeGemmKernel: Creating program from source\n", *kernelBinarySize);
196+
if (err != CL_SUCCESS) {
197+
printf("makeGemmKernel: Failed to build program from binary\n");
198+
}
199+
#endif
200+
}
201+
202+
if (!*kernelBinary || err != CL_SUCCESS) {
203+
#ifdef AUTOGEMM_PRINT_DEBUG
204+
printf("makeGemmKernel: Creating program from source\n");
194205
#endif
195206
clProgram = clCreateProgramWithSource(
196207
clContext,

src/library/blas/xtrsm.cc

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,21 +189,32 @@ void makeKernel(
189189
if (*kernelBinary) {
190190
#ifdef AUTOGEMM_PRINT_DEBUG
191191
printf("makeKernel: pre-compiled binary found: %llu bytes\n", *kernelBinarySize);
192+
printf("makeKernel: Creating program from binary\n");
192193
#endif
193194
clProgram = clCreateProgramWithBinary(
194195
clContext,
195196
1, &clDevice,
196197
kernelBinarySize, kernelBinary,
197198
&clBinaryStatus, &err );
198-
CL_CHECK(err)
199+
#ifdef AUTOGEMM_PRINT_DEBUG
200+
if (err != CL_SUCCESS) {
201+
printf("makeKernel: Failed to create program with binary\n");
202+
}
203+
#endif
199204
err = clBuildProgram(
200205
clProgram,
201206
1, &clDevice,
202207
binaryBuildOptions, NULL, NULL );
203-
CL_CHECK(err)
204-
} else {
205208
#ifdef AUTOGEMM_PRINT_DEBUG
206-
printf("makeKernel: Creating program from source\n", *kernelBinarySize);
209+
if (err != CL_SUCCESS) {
210+
printf("makeKernel: Failed to build program from binary\n");
211+
}
212+
#endif
213+
}
214+
215+
if (!*kernelBinary || err != CL_SUCCESS) {
216+
#ifdef AUTOGEMM_PRINT_DEBUG
217+
printf("makeKernel: Creating program from source\n");
207218
#endif
208219
clProgram = clCreateProgramWithSource(
209220
clContext,

0 commit comments

Comments
 (0)