-
Notifications
You must be signed in to change notification settings - Fork 801
[SYCL][Driver] Support bfloat16 devicelib selection when multiple AOT targets specified #16494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…support native bfloat16 conversion
clang/lib/Driver/ToolChains/SYCL.cpp
Outdated
| // 1). clang++ -fsycl -fsycl-targets=spir64_gen -Xs "-device pvc,...," | ||
| // 2). clang++ -fsycl -fsycl-targets=intel_gpu_pvc,... | ||
| // We assume that users will only apply either 1) or 2) and won't mix the | ||
| // 2 ways in their compiling command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the case where we can specify Intel GPUs via --offload-arch option?
clang++ --offload-new-driver -fsycl --offload-arch=bdw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @srividya-sundaram
Thanks for pointing out this, this PR didn't consider new offload driver, I will update it.
Thanks very much.
|
Please add some description to the PR in addition to the PR title. |
Co-authored-by: Michael Toguchi <[email protected]>
Co-authored-by: Michael Toguchi <[email protected]>
Co-authored-by: Michael Toguchi <[email protected]>
Co-authored-by: Michael Toguchi <[email protected]>
Signed-off-by: jinge90 <[email protected]>
clang/lib/Driver/ToolChains/SYCL.cpp
Outdated
| static llvm::SmallSet<StringRef, 8> GPUArchsWithNBF16{ | ||
| "intel_gpu_pvc", "intel_gpu_acm_g10", "intel_gpu_acm_g11", | ||
| "intel_gpu_acm_g12", "intel_gpu_bmg_g21"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine as a short-term fix, but longer-term we should be thinking of a different way to identify architectures with bfloat16 support that doesn't require maintaining a list of devices. For example, is there a way to query the properties of the target device(s) to determine if bfloat16 is supported?
Note that Lunar Lake GPUs also support bfloat16 (I think), and it's not in this list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @bashbaug
The bf16 support can be queried in execution time because we can only know the real target the program is running during execution time. In compilation time for AOT mode, compiler driver can only decide according to target platform specified and we have to maintain the bf16 support information in compiler driver source code, otherwise compiler driver won't know whether a target platform supports bf16. The platform we are building the program may be different from the platform the program is going to run on.
Thanks very much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we call into ocloc to do the query? For example, if we're AOT compiling for DG2, we could do something like (this example uses the ocloc command-line interface, but the same is supported for the library interface):
$ ocloc query CL_DEVICE_EXTENSIONS_WITH_VERSION -device dg2
<snip> cl_intel_bfloat16_conversions:1.0.0 <snip>Because the cl_intel_bfloat16_conversions extension is supported, we can know that DG2 supports SPIR-V bfloat16 conversion instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @bashbaug
I just tried the ocloc command but found after running "ocloc query CL_DEVICE_EXTENSIONS_WITH_VERSION -device dg2" but found a file named with "CL_DEVICE_EXTENSIONS_WITH_VERSION" is generated in local directory, it seems to be ocloc's behavior, is there any way to get rid of this?
Thanks very much.
Co-authored-by: Michael Toguchi <[email protected]>
Signed-off-by: jinge90 <[email protected]>
|
Hi, @mdtoguchi Thanks very much. |
Signed-off-by: jinge90 <[email protected]>
For |
User can specify multiple AOT targets when building sycl program in followings ways:
1). via -fsycl-targets=intel_gpu_pvc,intel_gpu_acm_g10,....
2). via -fsycl-targets=spir64_gen ... -Xs "-device pvc,dg2...."
3). via -fsycl-targets=spir64_gen..., -Xsycl-target-backend=spir64_gen "-device pvc"
We should select native bfloat16 devicelib when all AOT targets specified support native bfloat16 conversion. Currently, pvc, dg2, bmg devices support native bfloat16.
If user specifies JIT target together with AOT targets which all support native bfloat16 conversion, we still select native bfloat16 devicelib since bfloat16 devicelib is skipped in linking step for JIT target.