Commit aee2651
committed
opencl: never enqueue a zero-size NDRange
clEnqueueNDRangeKernel returns CL_INVALID_GLOBAL_WORK_SIZE if any
global_work_size[i] is 0, and the CL_CHECK around it aborts the process. Most
drivers accept a zero-size range and do nothing, so the bug is invisible on
them; strict drivers enforce the spec and take the process down. This is a
spec violation on our side, not a device quirk.
Skip the enqueue when any global dimension is zero, at the single choke point
all dispatches funnel through. A dimension that is wrongly zero still surfaces
as a wrong result rather than being masked.
Scope was established by running the op suite on an UNGUARDED build: of the 74
ops in test-backend-ops, SET_ROWS is the only one that emits a zero-size
dispatch (a row-less tensor, ne01 == 0).
Verified on device:
Adreno 619 aborted at SET_ROWS(f32->f32,i64,ne=[33,5,1,1],nr23=[2,3]) -> runs
Adreno 642L same abort -> runs
Adreno 840 op suite unchanged (lax driver, never hit the path)
Adreno 740 op suite unchanged1 parent ec2ad85 commit aee2651
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1069 | 1080 | | |
1070 | 1081 | | |
1071 | 1082 | | |
| |||
11977 | 11988 | | |
11978 | 11989 | | |
11979 | 11990 | | |
| 11991 | + | |
11980 | 11992 | | |
11981 | 11993 | | |
11982 | 11994 | | |
| |||
0 commit comments