Skip to content

Commit 479e133

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents 33707fe + c1ce159 commit 479e133

File tree

102 files changed

+1097
-761
lines changed

Some content is hidden

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

102 files changed

+1097
-761
lines changed

.github/workflows/sycl_linux_precommit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
branches:
99
- sycl
1010
- sycl-devops-pr/**
11+
- sycl-rel-**
1112
# Do not run builds if changes are only in the following locations
1213
paths-ignore:
1314
- '.github/ISSUE_TEMPLATE/**'

.github/workflows/sycl_post_commit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- sycl
77
- sycl-devops-pr/**
8+
- sycl-rel-**
89

910
pull_request:
1011
branches:

.github/workflows/sycl_windows_precommit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- sycl
77
- sycl-devops-pr/**
88
- llvmspirv_pulldown
9+
- sycl-rel-**
910
# Do not run builds if changes are only in the following locations
1011
paths-ignore:
1112
- '.github/ISSUE_TEMPLATE/**'

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,15 +890,31 @@ StringRef SYCL::gen::resolveGenDevice(StringRef DeviceName) {
890890
.Case("amd_gpu_gfx904", "gfx904")
891891
.Case("amd_gpu_gfx906", "gfx906")
892892
.Case("amd_gpu_gfx908", "gfx908")
893+
.Case("amd_gpu_gfx909", "gfx909")
893894
.Case("amd_gpu_gfx90a", "gfx90a")
895+
.Case("amd_gpu_gfx90c", "gfx90c")
896+
.Case("amd_gpu_gfx940", "gfx940")
897+
.Case("amd_gpu_gfx941", "gfx941")
898+
.Case("amd_gpu_gfx942", "gfx942")
894899
.Case("amd_gpu_gfx1010", "gfx1010")
895900
.Case("amd_gpu_gfx1011", "gfx1011")
896901
.Case("amd_gpu_gfx1012", "gfx1012")
897902
.Case("amd_gpu_gfx1013", "gfx1013")
898903
.Case("amd_gpu_gfx1030", "gfx1030")
899904
.Case("amd_gpu_gfx1031", "gfx1031")
900905
.Case("amd_gpu_gfx1032", "gfx1032")
906+
.Case("amd_gpu_gfx1033", "gfx1033")
901907
.Case("amd_gpu_gfx1034", "gfx1034")
908+
.Case("amd_gpu_gfx1035", "gfx1035")
909+
.Case("amd_gpu_gfx1036", "gfx1036")
910+
.Case("amd_gpu_gfx1100", "gfx1100")
911+
.Case("amd_gpu_gfx1101", "gfx1101")
912+
.Case("amd_gpu_gfx1102", "gfx1102")
913+
.Case("amd_gpu_gfx1103", "gfx1103")
914+
.Case("amd_gpu_gfx1150", "gfx1150")
915+
.Case("amd_gpu_gfx1151", "gfx1151")
916+
.Case("amd_gpu_gfx1200", "gfx1200")
917+
.Case("amd_gpu_gfx1201", "gfx1201")
902918
.Default("");
903919
return Device;
904920
}
@@ -954,15 +970,31 @@ SmallString<64> SYCL::gen::getGenDeviceMacro(StringRef DeviceName) {
954970
.Case("gfx904", "AMD_GPU_GFX904")
955971
.Case("gfx906", "AMD_GPU_GFX906")
956972
.Case("gfx908", "AMD_GPU_GFX908")
973+
.Case("gfx909", "AMD_GPU_GFX909")
957974
.Case("gfx90a", "AMD_GPU_GFX90A")
975+
.Case("gfx90c", "AMD_GPU_GFX90C")
976+
.Case("gfx940", "AMD_GPU_GFX940")
977+
.Case("gfx941", "AMD_GPU_GFX941")
978+
.Case("gfx942", "AMD_GPU_GFX942")
958979
.Case("gfx1010", "AMD_GPU_GFX1010")
959980
.Case("gfx1011", "AMD_GPU_GFX1011")
960981
.Case("gfx1012", "AMD_GPU_GFX1012")
961982
.Case("gfx1013", "AMD_GPU_GFX1013")
962983
.Case("gfx1030", "AMD_GPU_GFX1030")
963984
.Case("gfx1031", "AMD_GPU_GFX1031")
964985
.Case("gfx1032", "AMD_GPU_GFX1032")
986+
.Case("gfx1033", "AMD_GPU_GFX1033")
965987
.Case("gfx1034", "AMD_GPU_GFX1034")
988+
.Case("gfx1035", "AMD_GPU_GFX1035")
989+
.Case("gfx1036", "AMD_GPU_GFX1036")
990+
.Case("gfx1100", "AMD_GPU_GFX1100")
991+
.Case("gfx1101", "AMD_GPU_GFX1101")
992+
.Case("gfx1102", "AMD_GPU_GFX1102")
993+
.Case("gfx1103", "AMD_GPU_GFX1103")
994+
.Case("gfx1150", "AMD_GPU_GFX1150")
995+
.Case("gfx1151", "AMD_GPU_GFX1151")
996+
.Case("gfx1200", "AMD_GPU_GFX1200")
997+
.Case("gfx1201", "AMD_GPU_GFX1201")
966998
.Default("");
967999
if (!Ext.empty()) {
9681000
Macro = "__SYCL_TARGET_";

clang/test/Driver/sycl-oneapi-gpu.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,18 @@
161161
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx906 -DMAC_STR=GFX906
162162
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx908 -### %s 2>&1 | \
163163
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx908 -DMAC_STR=GFX908
164+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx909 -### %s 2>&1 | \
165+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx909 -DMAC_STR=GFX909
164166
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx90a -### %s 2>&1 | \
165167
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx90a -DMAC_STR=GFX90A
168+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx90c -### %s 2>&1 | \
169+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx90c -DMAC_STR=GFX90C
170+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx940 -### %s 2>&1 | \
171+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx940 -DMAC_STR=GFX940
172+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx941 -### %s 2>&1 | \
173+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx941 -DMAC_STR=GFX941
174+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx942 -### %s 2>&1 | \
175+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx942 -DMAC_STR=GFX942
166176
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1010 -### %s 2>&1 | \
167177
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1010 -DMAC_STR=GFX1010
168178
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1011 -### %s 2>&1 | \
@@ -177,8 +187,30 @@
177187
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1031 -DMAC_STR=GFX1031
178188
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1032 -### %s 2>&1 | \
179189
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1032 -DMAC_STR=GFX1032
190+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1033 -### %s 2>&1 | \
191+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1033 -DMAC_STR=GFX1033
180192
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1034 -### %s 2>&1 | \
181193
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1034 -DMAC_STR=GFX1034
194+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1035 -### %s 2>&1 | \
195+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1035 -DMAC_STR=GFX1035
196+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1036 -### %s 2>&1 | \
197+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1036 -DMAC_STR=GFX1036
198+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1100 -### %s 2>&1 | \
199+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1100 -DMAC_STR=GFX1100
200+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1101 -### %s 2>&1 | \
201+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1101 -DMAC_STR=GFX1101
202+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1102 -### %s 2>&1 | \
203+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1102 -DMAC_STR=GFX1102
204+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1103 -### %s 2>&1 | \
205+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1103 -DMAC_STR=GFX1103
206+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1150 -### %s 2>&1 | \
207+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1150 -DMAC_STR=GFX1150
208+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1151 -### %s 2>&1 | \
209+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1151 -DMAC_STR=GFX1151
210+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1200 -### %s 2>&1 | \
211+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1200 -DMAC_STR=GFX1200
212+
// RUN: %clangxx -fsycl -nogpulib -fsycl-targets=amd_gpu_gfx1201 -### %s 2>&1 | \
213+
// RUN: FileCheck %s --check-prefixes=DEVICE_AMD,MACRO_AMD -DDEV_STR=gfx1201 -DMAC_STR=GFX1201
182214
// MACRO_AMD: clang{{.*}} "-triple" "amdgcn-amd-amdhsa"
183215
// MACRO_AMD: "-D__SYCL_TARGET_AMD_GPU_[[MAC_STR]]__"
184216
// DEVICE_AMD: clang-offload-wrapper{{.*}} "-compile-opts=--offload-arch=[[DEV_STR]]{{.*}}"

llvm-spirv/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![In-tree build & tests](https://github.com/KhronosGroup/SPIRV-LLVM-Translator/actions/workflows/check-in-tree-build.yml/badge.svg?branch=main&event=schedule)](https://github.com/KhronosGroup/SPIRV-LLVM-Translator/actions?query=workflow%3A%22In-tree+build+%26+tests%22+event%3Aschedule)
55

66
This repository contains source code for the LLVM/SPIR-V Bi-Directional Translator, a library and tool for translation between LLVM IR and [SPIR-V](https://www.khronos.org/registry/spir-v/).
7+
This project currently only supports the OpenCL/compute "flavour" of SPIR-V: it consumes and produces SPIR-V modules that declare the `Kernel` capability.
78

89
The LLVM/SPIR-V Bi-Directional Translator is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.
910

llvm-spirv/lib/SPIRV/LLVMSPIRVOpts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ bool TranslatorOpts::isUnknownIntrinsicAllowed(IntrinsicInst *II) const
5454
const auto &IntrinsicPrefixList = SPIRVAllowUnknownIntrinsics.value();
5555
StringRef IntrinsicName = II->getCalledOperand()->getName();
5656
for (const auto &Prefix : IntrinsicPrefixList) {
57-
if (IntrinsicName.startswith(Prefix)) // Also true if `Prefix` is empty
57+
if (IntrinsicName.starts_with(Prefix)) // Also true if `Prefix` is empty
5858
return true;
5959
}
6060
return false;

llvm-spirv/lib/SPIRV/OCLToSPIRV.cpp

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ static Type *getBlockStructType(Value *Parameter) {
9090
/// for a demangled function name, or 0 if the function does not return an
9191
/// integer type (e.g. read_imagef).
9292
static unsigned getImageSignZeroExt(StringRef DemangledName) {
93-
bool IsSigned = !DemangledName.endswith("ui") && DemangledName.back() == 'i';
94-
bool IsUnsigned = DemangledName.endswith("ui");
93+
bool IsSigned = !DemangledName.ends_with("ui") && DemangledName.back() == 'i';
94+
bool IsUnsigned = DemangledName.ends_with("ui");
9595

9696
if (IsSigned)
9797
return ImageOperandsMask::ImageOperandsSignExtendMask;
@@ -327,8 +327,8 @@ void OCLToSPIRVBase::visitCallInst(CallInst &CI) {
327327
}
328328
if (DemangledName == kOCLBuiltinName::Dot ||
329329
DemangledName == kOCLBuiltinName::DotAccSat ||
330-
DemangledName.startswith(kOCLBuiltinName::Dot4x8PackedPrefix) ||
331-
DemangledName.startswith(kOCLBuiltinName::DotAccSat4x8PackedPrefix)) {
330+
DemangledName.starts_with(kOCLBuiltinName::Dot4x8PackedPrefix) ||
331+
DemangledName.starts_with(kOCLBuiltinName::DotAccSat4x8PackedPrefix)) {
332332
if (CI.getOperand(0)->getType()->isVectorTy()) {
333333
auto *VT = (VectorType *)(CI.getOperand(0)->getType());
334334
if (!isa<llvm::IntegerType>(VT->getElementType())) {
@@ -485,11 +485,12 @@ CallInst *OCLToSPIRVBase::visitCallAtomicCmpXchg(CallInst *CI) {
485485
Mutator.mapArg(1, [=](IRBuilder<> &Builder, Value *V) {
486486
return Builder.CreateLoad(MemTy, V, "exp");
487487
});
488-
Mutator.changeReturnType(MemTy, [&](IRBuilder<> &Builder, CallInst *NCI) {
489-
NewCI = NCI;
490-
Builder.CreateStore(NCI, Expected);
491-
return Builder.CreateICmpEQ(NCI, NCI->getArgOperand(1));
492-
});
488+
Mutator.changeReturnType(
489+
MemTy, [Expected, &NewCI](IRBuilder<> &Builder, CallInst *NCI) {
490+
NewCI = NCI;
491+
Builder.CreateStore(NCI, Expected);
492+
return Builder.CreateICmpEQ(NCI, NCI->getArgOperand(1));
493+
});
493494
}
494495
return NewCI;
495496
}
@@ -553,9 +554,9 @@ void OCLToSPIRVBase::transMemoryBarrier(CallInst *CI,
553554
void OCLToSPIRVBase::visitCallAtomicLegacy(CallInst *CI, StringRef MangledName,
554555
StringRef DemangledName) {
555556
StringRef Stem = DemangledName;
556-
if (Stem.startswith("atom_"))
557+
if (Stem.starts_with("atom_"))
557558
Stem = Stem.drop_front(strlen("atom_"));
558-
else if (Stem.startswith("atomic_"))
559+
else if (Stem.starts_with("atomic_"))
559560
Stem = Stem.drop_front(strlen("atomic_"));
560561
else
561562
return;
@@ -585,7 +586,7 @@ void OCLToSPIRVBase::visitCallAtomicLegacy(CallInst *CI, StringRef MangledName,
585586
Info.UniqName = "atomic_" + Prefix + Sign + Stem.str() + Postfix;
586587
std::vector<int> PostOps;
587588
PostOps.push_back(OCLLegacyAtomicMemOrder);
588-
if (Stem.startswith("compare_exchange"))
589+
if (Stem.starts_with("compare_exchange"))
589590
PostOps.push_back(OCLLegacyAtomicMemOrder);
590591
PostOps.push_back(OCLLegacyAtomicMemScope);
591592

@@ -600,24 +601,24 @@ void OCLToSPIRVBase::visitCallAtomicLegacy(CallInst *CI, StringRef MangledName,
600601
void OCLToSPIRVBase::visitCallAtomicCpp11(CallInst *CI, StringRef MangledName,
601602
StringRef DemangledName) {
602603
StringRef Stem = DemangledName;
603-
if (Stem.startswith("atomic_"))
604+
if (Stem.starts_with("atomic_"))
604605
Stem = Stem.drop_front(strlen("atomic_"));
605606
else
606607
return;
607608

608609
std::string NewStem(Stem);
609610
std::vector<int> PostOps;
610-
if (Stem.startswith("store") || Stem.startswith("load") ||
611-
Stem.startswith("exchange") || Stem.startswith("compare_exchange") ||
612-
Stem.startswith("fetch") || Stem.startswith("flag")) {
613-
if ((Stem.startswith("fetch_min") || Stem.startswith("fetch_max")) &&
611+
if (Stem.starts_with("store") || Stem.starts_with("load") ||
612+
Stem.starts_with("exchange") || Stem.starts_with("compare_exchange") ||
613+
Stem.starts_with("fetch") || Stem.starts_with("flag")) {
614+
if ((Stem.starts_with("fetch_min") || Stem.starts_with("fetch_max")) &&
614615
containsUnsignedAtomicType(MangledName))
615616
NewStem.insert(NewStem.begin() + strlen("fetch_"), 'u');
616617

617-
if (!Stem.endswith("_explicit")) {
618+
if (!Stem.ends_with("_explicit")) {
618619
NewStem = NewStem + "_explicit";
619620
PostOps.push_back(OCLMO_seq_cst);
620-
if (Stem.startswith("compare_exchange"))
621+
if (Stem.starts_with("compare_exchange"))
621622
PostOps.push_back(OCLMO_seq_cst);
622623
PostOps.push_back(OCLMS_device);
623624
} else {
@@ -792,7 +793,7 @@ void OCLToSPIRVBase::visitCallGroupBuiltin(CallInst *CI,
792793
FuncName = FuncName.drop_front(strlen(kSPIRVName::GroupPrefix));
793794
SPIRSPIRVGroupOperationMap::foreachConditional(
794795
[&](const std::string &S, SPIRVGroupOperationKind G) {
795-
if (!FuncName.startswith(S))
796+
if (!FuncName.starts_with(S))
796797
return true; // continue
797798
PreOps.push_back(G);
798799
StringRef Op =
@@ -886,7 +887,7 @@ void OCLToSPIRVBase::transBuiltin(CallInst *CI, OCLBuiltinTransInfo &Info) {
886887
Op OC = OpNop;
887888
unsigned ExtOp = ~0U;
888889
SPIRVBuiltinVariableKind BVKind = BuiltInMax;
889-
if (StringRef(Info.UniqName).startswith(kSPIRVName::Prefix))
890+
if (StringRef(Info.UniqName).starts_with(kSPIRVName::Prefix))
890891
return;
891892
if (OCLSPIRVBuiltinMap::find(Info.UniqName, &OC)) {
892893
if (OC == OpImageRead) {
@@ -912,16 +913,16 @@ void OCLToSPIRVBase::transBuiltin(CallInst *CI, OCLBuiltinTransInfo &Info) {
912913
Info.UniqName = getSPIRVFuncName(BVKind);
913914
} else
914915
return;
915-
auto Mutator = mutateCallInst(CI, Info.UniqName + Info.Postfix);
916+
BuiltinCallMutator Mutator = mutateCallInst(CI, Info.UniqName + Info.Postfix);
916917
Info.PostProc(Mutator);
917918
if (Info.RetTy) {
918919
Type *OldRetTy = CI->getType();
919920
Mutator.changeReturnType(
920-
Info.RetTy, [&](IRBuilder<> &Builder, CallInst *NewCI) {
921-
if (Info.RetTy->isIntegerTy() && OldRetTy->isIntegerTy())
921+
Info.RetTy, [OldRetTy, &Info](IRBuilder<> &Builder, CallInst *NewCI) {
922+
if (Info.RetTy->isIntegerTy() && OldRetTy->isIntegerTy()) {
922923
return Builder.CreateIntCast(NewCI, OldRetTy, Info.IsRetSigned);
923-
else
924-
return Builder.CreatePointerBitCastOrAddrSpaceCast(NewCI, OldRetTy);
924+
}
925+
return Builder.CreatePointerBitCastOrAddrSpaceCast(NewCI, OldRetTy);
925926
});
926927
}
927928
}
@@ -1221,7 +1222,7 @@ void OCLToSPIRVBase::visitCallDot(CallInst *CI, StringRef MangledName,
12211222
// dot(short2, ushort2) _Z3dotDv2_sDv2_t
12221223
// dot(ushort2, short2) _Z3dotDv2_tDv2_s
12231224
// dot(ushort2, ushort2) _Z3dotDv2_tS_
1224-
assert(MangledName.startswith("_Z3dotDv"));
1225+
assert(MangledName.starts_with("_Z3dotDv"));
12251226
if (MangledName[MangledName.size() - 1] == '_') {
12261227
IsFirstSigned = ((MangledName[MangledName.size() - 3] == 'c') ||
12271228
(MangledName[MangledName.size() - 3] == 's'));
@@ -1242,7 +1243,7 @@ void OCLToSPIRVBase::visitCallDot(CallInst *CI, StringRef MangledName,
12421243
// dot_acc_sat(short2, ushort2, int) _Z11dot_acc_satDv4_sDv4_ti
12431244
// dot_acc_sat(ushort2, short2, int) _Z11dot_acc_satDv4_tDv4_si
12441245
// dot_acc_sat(ushort2, ushort2, uint) _Z11dot_acc_satDv4_tS_j
1245-
assert(MangledName.startswith("_Z11dot_acc_satDv"));
1246+
assert(MangledName.starts_with("_Z11dot_acc_satDv"));
12461247
IsFirstSigned = ((MangledName[19] == 'c') || (MangledName[19] == 's'));
12471248
IsSecondSigned = (MangledName[20] == 'S'
12481249
? IsFirstSigned
@@ -1264,10 +1265,10 @@ void OCLToSPIRVBase::visitCallDot(CallInst *CI, StringRef MangledName,
12641265
// _Z28dot_acc_sat_4x8packed_us_intjji
12651266
// dot_acc_sat_4x8packed_uu_uint(uint, uint, uint)
12661267
// _Z29dot_acc_sat_4x8packed_uu_uintjjj
1267-
assert(MangledName.startswith("_Z20dot_4x8packed") ||
1268-
MangledName.startswith("_Z21dot_4x8packed") ||
1269-
MangledName.startswith("_Z28dot_acc_sat_4x8packed") ||
1270-
MangledName.startswith("_Z29dot_acc_sat_4x8packed"));
1268+
assert(MangledName.starts_with("_Z20dot_4x8packed") ||
1269+
MangledName.starts_with("_Z21dot_4x8packed") ||
1270+
MangledName.starts_with("_Z28dot_acc_sat_4x8packed") ||
1271+
MangledName.starts_with("_Z29dot_acc_sat_4x8packed"));
12711272
size_t SignIndex = IsAccSat
12721273
? strlen(kOCLBuiltinName::DotAccSat4x8PackedPrefix)
12731274
: strlen(kOCLBuiltinName::Dot4x8PackedPrefix);
@@ -1581,7 +1582,7 @@ static const char *getSubgroupAVCIntelTyKind(StringRef MangledName) {
15811582
// We're looking for the type name of the last parameter, which will be at the
15821583
// very end of the mangled name. Since we only care about the ending of the
15831584
// name, we don't need to be any more clever than this.
1584-
return MangledName.endswith("_payload_t") ? "payload" : "result";
1585+
return MangledName.ends_with("_payload_t") ? "payload" : "result";
15851586
}
15861587

15871588
static Type *getSubgroupAVCIntelMCEType(Module *M, std::string &TName) {

llvm-spirv/lib/SPIRV/OCLTypeToSPIRV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void OCLTypeToSPIRVBase::adaptFunctionArguments(Function *F) {
223223
auto STName = NewTy->getStructName();
224224
if (!hasAccessQualifiedName(STName))
225225
continue;
226-
if (STName.startswith(kSPR2TypeName::ImagePrefix)) {
226+
if (STName.starts_with(kSPR2TypeName::ImagePrefix)) {
227227
auto Ty = STName.str();
228228
auto Acc = getAccessQualifier(Ty);
229229
auto Desc = getImageDescriptor(ParamTys[I]);
@@ -251,7 +251,7 @@ void OCLTypeToSPIRVBase::adaptArgumentsByMetadata(Function *F) {
251251
if (OCLTyStr == OCL_TYPE_NAME_SAMPLER_T) {
252252
addAdaptedType(&(*Arg), getSPIRVType(OpTypeSampler));
253253
Changed = true;
254-
} else if (OCLTyStr.startswith("image") && OCLTyStr.endswith("_t")) {
254+
} else if (OCLTyStr.starts_with("image") && OCLTyStr.ends_with("_t")) {
255255
auto Ty = (Twine("opencl.") + OCLTyStr).str();
256256
if (auto *STy = StructType::getTypeByName(F->getContext(), Ty)) {
257257
auto *ImageTy = TypedPointerType::get(STy, SPIRAS_Global);

0 commit comments

Comments
 (0)