llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.72k stars 10.94k forks source link

opencl.ocl.version can not reflect opencl cpp source #91912

Closed haonanya closed 8 hours ago

haonanya commented 1 month ago

the option -cl-std=cl3.0 emits same metadata as -cl-std=clc++2021 and -cl-std=cl2.0 emits same metadata as -cl-std=clc++. In llvm-spirv, spirv.Source metadata is determined by opencl.ocl.version, which results in unexpected spirv.Source metadata for opencl cpp source https://github.com/KhronosGroup/SPIRV-Headers/blob/main/include/spirv/unified1/spirv.hpp#L67,L68. @svenvh, @AnastasiaStulova, @MrSidims, @VyacheslavLevytskyy

llvmbot commented 1 month ago

@llvm/issue-subscribers-opencl

Author: Haonan Yang (haonanya)

the option -cl-std=cl3.0 emits same metadata as -cl-std=clc++2021 and -cl-std=cl2.0 emits same metadata as -cl-std=clc++. In llvm-spirv, spirv.Source metadata is determined by opencl.ocl.version, which results in unexpected spirv.Source metadata for opencl cpp source https://github.com/KhronosGroup/SPIRV-Headers/blob/main/include/spirv/unified1/spirv.hpp#L67,L68. @svenvh, @AnastasiaStulova, @MrSidims, @VyacheslavLevytskyy
svenvh commented 1 month ago

It is probably long overdue to emit some metadata to distinguish between C and C++ sources. I've created https://github.com/llvm/llvm-project/pull/92140 as a first step to address this.

llvmbot commented 5 hours ago

@llvm/issue-subscribers-clang-codegen

Author: Haonan Yang (haonanya)

the option -cl-std=cl3.0 emits same metadata as -cl-std=clc++2021 and -cl-std=cl2.0 emits same metadata as -cl-std=clc++. In llvm-spirv, spirv.Source metadata is determined by opencl.ocl.version, which results in unexpected spirv.Source metadata for opencl cpp source https://github.com/KhronosGroup/SPIRV-Headers/blob/main/include/spirv/unified1/spirv.hpp#L67,L68. @svenvh, @AnastasiaStulova, @MrSidims, @VyacheslavLevytskyy