Skip to content

Commit 745d9b5

Browse files
committed
Merge branch 'sycl' into inlineasm-litlocal
2 parents e91210e + 34ef866 commit 745d9b5

File tree

48 files changed

+1085
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1085
-478
lines changed

.ci/metrics/requirements.lock.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pygithub==2.5.0 \
231231
--hash=sha256:b0b635999a658ab8e08720bdd3318893ff20e2275f6446fcf35bf3f44f2c0fd2 \
232232
--hash=sha256:e1613ac508a9be710920d26eb18b1905ebd9926aa49398e88151c1b526aad3cf
233233
# via -r ./requirements.txt
234-
pyjwt[crypto]==2.10.0 \
234+
pyjwt[crypto]==2.10.1 \
235235
--hash=sha256:543b77207db656de204372350926bed5a86201c4cbff159f623f79c7bb487a15 \
236236
--hash=sha256:7628a7eb7938959ac1b26e819a1df0fd3259505627b575e4bad6d08f76db695c
237237
# via pygithub

.github/workflows/sycl-containers.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ jobs:
5151
file: ubuntu2404_build
5252
tag: latest
5353
build_args: ""
54-
- name: Build Ubuntu 24.04 oneAPI Docker image
55-
file: ubuntu2404_build_oneapi
56-
tag: latest
57-
build_args: ""
5854
- name: Intel Drivers Ubuntu 22.04 Docker image
5955
file: ubuntu2204_intel_drivers
6056
tag: latest

.github/workflows/sycl-linux-build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,21 @@ jobs:
152152
ref: ${{ inputs.build_ref || github.sha }}
153153
merge_ref: ${{ inputs.merge_ref }}
154154
cache_path: "/__w/repo_cache/"
155+
- name: Setup oneAPI env
156+
if: ${{ inputs.cc == 'icx' || inputs.cxx == 'icpx' }}
157+
uses: ./devops/actions/setup_linux_oneapi_env
155158
- name: Configure
156159
env:
157160
CC: ${{ inputs.cc }}
158161
CXX: ${{ inputs.cxx }}
159-
ARGS: ${{ inputs.build_configure_extra_args }}
160162
CUDA_LIB_PATH: "/usr/local/cuda/lib64/stubs"
161163
run: |
162164
mkdir -p $CCACHE_DIR
163165
mkdir -p $GITHUB_WORKSPACE/build
164166
cd $GITHUB_WORKSPACE/build
165167
python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \
166168
-s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \
167-
--ci-defaults $ARGS \
169+
--ci-defaults ${{ inputs.build_configure_extra_args }} \
168170
--cmake-opt=-DCMAKE_C_COMPILER_LAUNCHER=ccache \
169171
--cmake-opt=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
170172
--cmake-opt="-DLLVM_INSTALL_UTILS=ON" \

.github/workflows/sycl-linux-matrix-e2e-on-nightly.yml

Lines changed: 0 additions & 95 deletions
This file was deleted.

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,9 @@ on:
127127
- '["cts-cpu"]'
128128
- '["Linux", "build"]'
129129
image:
130-
description: |
131-
Use option ending with ":build" for AMDGPU, ":latest" for the rest.
132130
type: choice
133131
options:
134-
- 'ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:latest'
135-
- 'ghcr.io/intel/llvm/sycl_ubuntu2204_nightly:build'
132+
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest'
136133
image_options:
137134
description: |
138135
Use option with "--device=/dev/kfd" for AMDGPU, without it for the rest.

.github/workflows/sycl-nightly.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ jobs:
3737

3838
artifact_archive_name: sycl_linux_shared.tar.zst
3939

40+
ubuntu2404_oneapi_build:
41+
if: github.repository == 'intel/llvm'
42+
uses: ./.github/workflows/sycl-linux-build.yml
43+
secrets: inherit
44+
with:
45+
build_cache_root: "/__w/"
46+
build_cache_suffix: oneapi
47+
build_artifact_suffix: oneapi
48+
build_configure_extra_args: --cmake-opt=-DCMAKE_C_FLAGS="-no-intel-lib -ffp-model=precise" --cmake-opt=-DCMAKE_CXX_FLAGS="-no-intel-lib -ffp-model=precise"
49+
cc: icx
50+
cxx: icpx
51+
52+
artifact_archive_name: sycl_linux_oneapi.tar.zst
53+
4054
ubuntu2204_test:
4155
needs: [ubuntu2204_build]
4256
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
@@ -103,6 +117,23 @@ jobs:
103117
sycl_toolchain_archive: ${{ needs.ubuntu2204_build.outputs.artifact_archive_name }}
104118
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
105119

120+
ubuntu2404_oneapi_test:
121+
needs: [ubuntu2404_oneapi_build]
122+
if: ${{ always() && !cancelled() && needs.ubuntu2404_oneapi_build.outputs.build_conclusion == 'success' }}
123+
uses: ./.github/workflows/sycl-linux-run-tests.yml
124+
with:
125+
name: Intel PVC L0 oneAPI
126+
runner: '["Linux", "pvc"]'
127+
target_devices: level_zero:gpu
128+
extra_lit_opts: -j 50
129+
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
130+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
131+
ref: ${{ github.sha }}
132+
merge_ref: ''
133+
sycl_toolchain_artifact: sycl_linux_oneapi
134+
sycl_toolchain_archive: ${{ needs.ubuntu2404_oneapi_build.outputs.artifact_archive_name }}
135+
sycl_toolchain_decompress_command: ${{ needs.ubuntu2404_oneapi_build.outputs.artifact_decompress_command }}
136+
106137
build-win:
107138
uses: ./.github/workflows/sycl-windows-build.yml
108139
if: github.repository == 'intel/llvm'

.github/workflows/sycl-windows-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ jobs:
149149
shell: bash
150150
run: |
151151
if [[ ${{inputs.compiler}} == 'icx' ]]; then
152-
export LIT_FILTER_OUT="host_tanpi_double_accuracy"
152+
export LIT_XFAIL="regression\host_tanpi_double_accuracy.cpp"
153153
fi
154154
cmake --build build --target check-sycl
155155
- name: check-sycl-unittests

clang/include/clang/Basic/Attr.td

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,22 @@ def SYCLAddIRAnnotationsMember : InheritableAttr {
21472147
let Documentation = [SYCLAddIRAnnotationsMemberDocs];
21482148
}
21492149

2150+
def SYCLRegisteredKernels : InheritableAttr {
2151+
let Spellings = [CXX11<"__sycl_detail__", "__registered_kernels__">];
2152+
let Args = [VariadicExprArgument<"Args">];
2153+
let LangOpts = [SYCLIsDevice, SilentlyIgnoreSYCLIsHost];
2154+
let Subjects = SubjectList<[Empty], ErrorDiag, "Translation Unit Scope">;
2155+
let AdditionalMembers = SYCLAddIRAttrCommonMembers.MemberCode;
2156+
let Documentation = [SYCLAddIRAnnotationsMemberDocs];
2157+
}
2158+
2159+
def SYCLRegisteredKernelName : InheritableAttr {
2160+
let Spellings = [];
2161+
let Subjects = SubjectList<[Function]>;
2162+
let Args = [StringArgument<"RegName">];
2163+
let Documentation = [InternalOnly];
2164+
}
2165+
21502166
def C11NoReturn : InheritableAttr {
21512167
let Spellings = [CustomKeyword<"_Noreturn">];
21522168
let Subjects = SubjectList<[Function], ErrorDiag>;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12546,6 +12546,20 @@ def err_sycl_special_type_num_init_method : Error<
1254612546
def warn_launch_bounds_is_cuda_specific : Warning<
1254712547
"%0 attribute ignored, only applicable when targeting Nvidia devices">,
1254812548
InGroup<IgnoredAttributes>;
12549+
def err_registered_kernels_num_of_args : Error<
12550+
"'__registered_kernels__' attribute must have at least one argument">;
12551+
def err_registered_kernels_init_list : Error<
12552+
"argument to the '__registered_kernels__' attribute must be an "
12553+
"initializer list expression">;
12554+
def err_registered_kernels_init_list_pair_values : Error<
12555+
"each initializer list argument to the '__registered_kernels__' attribute "
12556+
"must contain a pair of values">;
12557+
def err_registered_kernels_resolve_function : Error<
12558+
"unable to resolve free function kernel '%0'">;
12559+
def err_registered_kernels_name_already_registered : Error<
12560+
"free function kernel has already been registered with '%0'; cannot register with '%1'">;
12561+
def err_not_sycl_free_function : Error<
12562+
"attempting to register a function that is not a SYCL free function as '%0'">;
1254912563

1255012564
def warn_cuda_maxclusterrank_sm_90 : Warning<
1255112565
"'maxclusterrank' requires sm_90 or higher, CUDA arch provided: %0, ignoring "

clang/include/clang/Sema/SemaSYCL.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ class SemaSYCL : public SemaBase {
252252
// We need to store the list of the sycl_kernel functions and their associated
253253
// generated OpenCL Kernels so we can go back and re-name these after the
254254
// fact.
255-
llvm::SmallVector<std::pair<const FunctionDecl *, FunctionDecl *>>
256-
SyclKernelsToOpenCLKernels;
255+
using KernelFDPairs =
256+
llvm::SmallVector<std::pair<const FunctionDecl *, FunctionDecl *>>;
257+
KernelFDPairs SyclKernelsToOpenCLKernels;
257258

258259
// Used to suppress diagnostics during kernel construction, since these were
259260
// already emitted earlier. Diagnosing during Kernel emissions also skips the
@@ -296,11 +297,15 @@ class SemaSYCL : public SemaBase {
296297
llvm::DenseSet<QualType> Visited,
297298
ValueDecl *DeclToCheck);
298299

300+
const KernelFDPairs &getKernelFDPairs() { return SyclKernelsToOpenCLKernels; }
301+
299302
void addSyclOpenCLKernel(const FunctionDecl *SyclKernel,
300303
FunctionDecl *OpenCLKernel) {
301304
SyclKernelsToOpenCLKernels.emplace_back(SyclKernel, OpenCLKernel);
302305
}
303306

307+
void constructFreeFunctionKernel(FunctionDecl *FD, StringRef NameStr = "");
308+
304309
void addSyclDeviceDecl(Decl *d) { SyclDeviceDecls.insert(d); }
305310
llvm::SetVector<Decl *> &syclDeviceDecls() { return SyclDeviceDecls; }
306311

@@ -480,6 +485,7 @@ class SemaSYCL : public SemaBase {
480485
void handleSYCLIntelMaxWorkGroupsPerMultiprocessor(Decl *D,
481486
const ParsedAttr &AL);
482487
void handleSYCLScopeAttr(Decl *D, const ParsedAttr &AL);
488+
void handleSYCLRegisteredKernels(Decl *D, const ParsedAttr &AL);
483489

484490
void checkSYCLAddIRAttributesFunctionAttrConflicts(Decl *D);
485491

@@ -655,6 +661,10 @@ class SemaSYCL : public SemaBase {
655661
void addIntelReqdSubGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI,
656662
Expr *E);
657663
void handleKernelEntryPointAttr(Decl *D, const ParsedAttr &AL);
664+
665+
// Used to check whether the function represented by FD is a SYCL
666+
// free function kernel or not.
667+
bool isFreeFunction(const FunctionDecl *FD);
658668
};
659669

660670
} // namespace clang

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,12 @@ void CodeGenFunction::EmitKernelMetadata(const FunctionDecl *FD,
641641

642642
llvm::LLVMContext &Context = getLLVMContext();
643643

644+
if (getLangOpts().SYCLIsDevice)
645+
if (FD->hasAttr<SYCLRegisteredKernelNameAttr>())
646+
CGM.SYCLAddRegKernelNamePairs(
647+
FD->getAttr<SYCLRegisteredKernelNameAttr>()->getRegName(),
648+
FD->getNameAsString());
649+
644650
if (FD->hasAttr<OpenCLKernelAttr>() || FD->hasAttr<CUDAGlobalAttr>())
645651
CGM.GenKernelArgMetadata(Fn, FD, this);
646652

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,19 @@ void CodeGenModule::Release() {
14311431
AspectEnumValsMD->addOperand(
14321432
getAspectEnumValueMD(Context, TheModule.getContext(), ECD));
14331433
}
1434+
1435+
if (!SYCLRegKernelNames.empty()) {
1436+
std::vector<llvm::Metadata *> Nodes;
1437+
llvm::LLVMContext &Ctx = TheModule.getContext();
1438+
for (auto MDKernelNames : SYCLRegKernelNames) {
1439+
llvm::Metadata *Vals[] = {MDKernelNames.first, MDKernelNames.second};
1440+
Nodes.push_back(llvm::MDTuple::get(Ctx, Vals));
1441+
}
1442+
1443+
llvm::NamedMDNode *SYCLRegKernelsMD =
1444+
TheModule.getOrInsertNamedMetadata("sycl_registered_kernels");
1445+
SYCLRegKernelsMD->addOperand(llvm::MDNode::get(Ctx, Nodes));
1446+
}
14341447
}
14351448

14361449
// HLSL related end of code gen work items.

clang/lib/CodeGen/CodeGenModule.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,9 @@ class CodeGenModule : public CodeGenTypeCache {
456456
/// handled differently than regular annotations so they cannot share map.
457457
llvm::DenseMap<unsigned, llvm::Constant *> SYCLAnnotationArgs;
458458

459+
typedef std::pair<llvm::Metadata *, llvm::Metadata *> MetadataPair;
460+
SmallVector<MetadataPair, 4> SYCLRegKernelNames;
461+
459462
llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
460463

461464
llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
@@ -1483,6 +1486,12 @@ class CodeGenModule : public CodeGenTypeCache {
14831486
llvm::Constant *EmitSYCLAnnotationArgs(
14841487
SmallVectorImpl<std::pair<std::string, std::string>> &Pairs);
14851488

1489+
void SYCLAddRegKernelNamePairs(StringRef First, StringRef Second) {
1490+
SYCLRegKernelNames.push_back(
1491+
std::make_pair(llvm::MDString::get(getLLVMContext(), First),
1492+
llvm::MDString::get(getLLVMContext(), Second)));
1493+
}
1494+
14861495
/// Add attributes from add_ir_attributes_global_variable on TND to GV.
14871496
void AddGlobalSYCLIRAttributes(llvm::GlobalVariable *GV,
14881497
const RecordDecl *RD);

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7479,6 +7479,9 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
74797479
case ParsedAttr::AT_SYCLAddIRAnnotationsMember:
74807480
S.SYCL().handleSYCLAddIRAnnotationsMemberAttr(D, AL);
74817481
break;
7482+
case ParsedAttr::AT_SYCLRegisteredKernels:
7483+
S.SYCL().handleSYCLRegisteredKernels(D, AL);
7484+
break;
74827485

74837486
// Swift attributes.
74847487
case ParsedAttr::AT_SwiftAsyncName:

0 commit comments

Comments
 (0)