karolherbst , Englisch
@karolherbst@chaos.social avatar

soooo.. in OpenCL C builtins like get_global_offset have to return defined values on out of bound accesses, but apparently Intel's driver also gets this wrong. Now I'm considering if I should keep it broken as well, or actually fix it as defined in the spec...

@bashbaug any thoughts on this? Maybe we should add OpenCL CTS tests for this and annoy everybody else with this?

tht ,
@tht@mstdn.social avatar

@karolherbst @bashbaug should follow the specs in my opinion

oblomov ,
@oblomov@sociale.network avatar

@karolherbst as a user (i.e. developer of OpenCL code), I'd ask you if possible to please go with the spec.

@bashbaug

bashbaug ,
@bashbaug@mastodon.gamedev.place avatar

@karolherbst Can you describe the failing case in more detail? I just did a few quick get_global_offset tests and everything is working as I'd expect.

Regardless, I agree we should have a CTS test for this. There is a get_global_offset test, but it's not currently testing out-of-range indices.

(Sorry for the slow reply, was on vacation and away from computers last week.)

karolherbst OP ,
@karolherbst@chaos.social avatar

@bashbaug we have some custom CL tests in piglit and this one seems to fail on my Intel one: https://gitlab.freedesktop.org/mesa/piglit/-/blob/main/tests/cl/program/execute/global-offset.cl?ref_type=heads#L97

It's the last "[test]" section in that file in case you want to adjust your local test program.

Here it returns "3" instead of "0" in the last line.

bashbaug ,
@bashbaug@mastodon.gamedev.place avatar

@karolherbst Thanks, I've reproduced the problem. Looks like no out-of-range checks are happening (oops). I filed https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2638, which I think is the best place to fix this.

Have you only seen this issue with get_global_offset?

karolherbst OP ,
@karolherbst@chaos.social avatar

@bashbaug I think this issue should exist with all builtins, but I'm wondering why the SPIRV-Translator is the best place, because I was seeing this with Intel-compute-runtime using OpenCL C as well.

Not saying that it won't make sense to fix it in the translator, but I think it depends on what's meant with "The mapping from an OpenCL C built-in function to the SPIR-V BuiltIn is informational and non-normative." in the env spec.

bashbaug ,
@bashbaug@mastodon.gamedev.place avatar

@karolherbst Our implementation compiles everything through SPIR-V, so the SPIR-V LLVM Translator is involved even when starting from OpenCL C.

Our OpenCL C flow currently goes OpenCL C -> LLVM IR (with calls to get_global_offset) -> SPIR-V (with vector BuiltIns and OpVectorExtractDynamic) -> our GPU compiler, so I think the only place where the fix could go is in the SPIR-V LLVM Translator, when the SPIR-V gets generated from the LLVM IR.

karolherbst OP ,
@karolherbst@chaos.social avatar

@bashbaug oh, I wasn't aware that you are also using SPIR-V internally. Is that an old change or something more recent?

bashbaug ,
@bashbaug@mastodon.gamedev.place avatar

@karolherbst We've been using SPIR-V internally for at least a couple of years, probably more like five years now. :)

  • Alle
  • Abonniert
  • Moderiert
  • Favoriten
  • random
  • haupteingang
  • Alle Magazine