Skip to content

Commit

Permalink
Merge branch 'sycl' of https://github.com/intel/llvm into benchmarkin…
Browse files Browse the repository at this point in the history
…g-workflow
  • Loading branch information
ianayl committed Jan 17, 2025
2 parents 30bd28c + a5e8209 commit a3b0487
Show file tree
Hide file tree
Showing 119 changed files with 662 additions and 404 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/sycl-linux-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ jobs:
#
# env: '{"LIT_FILTER":"PerformanceTests/"}'
# extra_lit_opts: -a -j 1 --param enable-perf-tests=True
# extra_cmake_args: ${{ matrix.extra_cmake_args }}
#
# ref: ${{ github.sha }}
# merge_ref: ''
Expand Down Expand Up @@ -324,4 +323,4 @@ jobs:

sycl_toolchain_artifact: sycl_linux_default
sycl_toolchain_archive: ${{ needs.build.outputs.artifact_archive_name }}
sycl_toolchain_decompress_command: ${{ needs.build.outputs.artifact_decompress_command }}
sycl_toolchain_decompress_command: ${{ needs.build.outputs.artifact_decompress_command }}
8 changes: 4 additions & 4 deletions devops/dependencies-igc-dev.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"linux": {
"igc_dev": {
"github_tag": "igc-dev-97b3d8f",
"version": "97b3d8f",
"updated_at": "2025-01-08T17:43:30Z",
"url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/2403247641/zip",
"github_tag": "igc-dev-61b96b3",
"version": "61b96b3",
"updated_at": "2025-01-15T17:43:30Z",
"url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/2435370337/zip",
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
}
}
Expand Down
4 changes: 2 additions & 2 deletions devops/scripts/install_build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ apt update && apt install -yqq \
jq \
curl \
libhwloc-dev \
libzstd-dev

libzstd-dev \
time
12 changes: 12 additions & 0 deletions libclc/clc/include/clc/common/clc_degrees.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef __CLC_COMMON_CLC_DEGREES_H__
#define __CLC_COMMON_CLC_DEGREES_H__

#define __CLC_BODY <clc/math/unary_decl.inc>
#define __CLC_FUNCTION __clc_degrees

#include <clc/math/gentype.inc>

#undef __CLC_BODY
#undef __CLC_FUNCTION

#endif // __CLC_COMMON_CLC_DEGREES_H__
9 changes: 9 additions & 0 deletions libclc/clc/include/clc/common/unary_def.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <clc/utils.h>

#ifndef __CLC_FUNCTION
#define __CLC_FUNCTION(x) __CLC_CONCAT(__clc_, x)
#endif

_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE a) {
return __CLC_FUNCTION(FUNCTION)(a);
}
1 change: 1 addition & 0 deletions libclc/clc/lib/generic/SOURCES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
common/clc_degrees.cl
geometric/clc_dot.cl
integer/clc_abs.cl
integer/clc_abs_diff.cl
Expand Down
31 changes: 31 additions & 0 deletions libclc/clc/lib/generic/common/clc_degrees.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <clc/clcmacro.h>

_CLC_OVERLOAD _CLC_DEF float __clc_degrees(float radians) {
// 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F
return 0x1.ca5dc2p+5F * radians;
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __clc_degrees, float);

#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable

_CLC_OVERLOAD _CLC_DEF double __clc_degrees(double radians) {
// 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F
return 0x1.ca5dc1a63c1f8p+5 * radians;
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __clc_degrees, double);

#endif

#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_OVERLOAD _CLC_DEF half __clc_degrees(half radians) {
return __clc_degrees((float)radians);
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __clc_degrees, half);

#endif
23 changes: 4 additions & 19 deletions libclc/generic/lib/common/degrees.cl
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,8 @@
*/

#include <clc/clc.h>
#include <clc/clcmacro.h>
#include <libspirv/spirv.h>
#include <clc/common/clc_degrees.h>

_CLC_OVERLOAD _CLC_DEF float degrees(float radians) {
return __spirv_ocl_degrees(radians);
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, degrees, float);


#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable

_CLC_OVERLOAD _CLC_DEF double degrees(double radians) {
return __spirv_ocl_degrees(radians);
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, degrees, double);

#endif
#define FUNCTION degrees
#define __CLC_BODY <clc/common/unary_def.inc>
#include <clc/math/gentype.inc>
39 changes: 6 additions & 33 deletions libclc/libspirv/lib/generic/common/degrees.cl
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,11 @@
//
//===----------------------------------------------------------------------===//

#include <clc/clc.h>
#include <clc/common/clc_degrees.h>
#include <libspirv/spirv.h>

#include <clc/clcmacro.h>

_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_degrees(float radians) {
// 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F
return 0x1.ca5dc2p+5F * radians;
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_degrees, float);


#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable

_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_degrees(double radians) {
// 180/pi = ~57.29577951308232087685 or 0x1.ca5dc1a63c1f8p+5 or 0x1.ca5dc2p+5F
return 0x1.ca5dc1a63c1f8p+5 * radians;
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_degrees,
double);

#endif

#ifdef cl_khr_fp16
#pragma OPENCL EXTENSION cl_khr_fp16 : enable

_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_degrees(half radians) {
return __spirv_ocl_degrees((float)radians);
}

_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_degrees, half);

#endif
#define FUNCTION __spirv_ocl_degrees
#define __CLC_FUNCTION(x) __clc_degrees
#define __CLC_BODY <clc/common/unary_def.inc>
#include <clc/math/gentype.inc>
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
; RUN: llvm-spirv %t.spv -to-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV

; TODO: enable back once the reverse translation with untyped pointers is fixed
; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-GENERAL

; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-INTEL
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV-DAG: Capability JointMatrixINTEL
; CHECK-SPIRV-DAG: Extension "SPV_INTEL_joint_matrix"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
; RUN: llvm-spirv %t.spv -to-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV

; TODO: enable back once the reverse translation with untyped pointers is fixed
; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-MATRIX
; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-GENERAL
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV-DAG: Capability CooperativeMatrixKHR
; CHECK-SPIRV-DAG: Capability CooperativeMatrixInvocationInstructionsINTEL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
; RUN: llvm-spirv %t.spv -to-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV

; TODO: enable back once the reverse translation with untyped pointers is fixed
; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-GENERAL

; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-INTEL
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV-DAG: TypeInt [[#SHORT:]] 16
; CHECK-SPIRV-DAG: TypeInt [[#INT:]] 32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@
; RUN: llvm-spirv %t.spv -to-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV

; TODO: enable back once the reverse translation with untyped pointers is fixed
; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-GENERAL

; R/UN: llvm-spirv -r %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM-INTEL

; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV-DAG: TypeInt [[#INT:]] 32
; CHECK-SPIRV-DAG: TypeFloat [[#Half:]] 16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
; RUN: llvm-spirv %t.spv -to-text -o %t.spt
; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV

; TODO: enable back once the reverse translation with untyped pointers is fixed
; R/UN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
; R/UN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV-DAG: Capability CooperativeMatrixKHR
; CHECK-SPIRV-DAG: Extension "SPV_KHR_cooperative_matrix"
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/SYCLLowerIR/ESIMD/ESIMDOptimizeVecArgCallConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,8 @@ optimizeFunction(Function *OldF,
// preserve data flow equality to the original.
unsigned OldArgNo = PI.getFormalParam().getArgNo();
unsigned NewArgNo = oldArgNo2NewArgNo(OldArgNo, SretInd);
Instruction *At = nullptr;
Value *Val = NewF->getArg(NewArgNo);
StoreInst *St = new StoreInst(Val, Alloca, false, Al, At);
StoreInst *St = new StoreInst(Val, Alloca, false, Al);
NewInsts.push_back(St);
}
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ static Instruction *addCastInstIfNeeded(Instruction *OldI, Instruction *NewI,
if (OITy != NITy) {
auto CastOpcode = CastInst::getCastOpcode(NewI, false, OITy, false);
NewI = CastInst::Create(CastOpcode, NewI, OITy,
NewI->getName() + ".cast.ty", OldI);
NewI->getName() + ".cast.ty", OldI->getIterator());
NewI->setDebugLoc(OldI->getDebugLoc());
}
return NewI;
Expand Down Expand Up @@ -1565,7 +1565,7 @@ static void translateESIMDIntrinsicCall(CallInst &CI) {
CallInst *NewCI = IntrinsicInst::Create(
NewFDecl, GenXArgs,
NewFDecl->getReturnType()->isVoidTy() ? "" : CI.getName() + ".esimd",
&CI);
CI.getIterator());
NewCI->setDebugLoc(CI.getDebugLoc());
if (DoesFunctionReturnStructure) {
IRBuilder<> Builder(&CI);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/GlobalOffset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void GlobalOffsetPass::addImplicitParameterToCallers(
/* Func= */ CalleeWithImplicitParam,
/* Args= */ ImplicitOffsets,
/* NameStr= */ Twine(),
/* InsertBefore= */ CallToOld);
/* InsertBefore= */ CallToOld->getIterator());
NewCallInst->setTailCallKind(CallToOld->getTailCallKind());
NewCallInst->copyMetadata(*CallToOld);
CallToOld->replaceAllUsesWith(NewCallInst);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/LocalAccessorToSharedMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Function *LocalAccessorToSharedMemoryPass::processKernel(Module &M,
ConstantInt::get(Type::getInt32Ty(M.getContext()), 0, false),
NFA,
},
/* NameStr= */ Twine{NFA->getName()}, InsertBefore);
/* NameStr= */ Twine{NFA->getName()}, InsertBefore->getIterator());
// Then create a bitcast to make sure the new pointer is the same type
// as the old one. This will only ever be a `i8 addrspace(3)*` to `i32
// addrspace(3)*` type of cast.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/SYCLLowerIR/LowerInvokeSimd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ bool processInvokeSimdCall(CallInst *InvokeSimd,
NewInvokeSimdArgs.push_back(NewHelper);
auto ThirdArg = std::next(InvokeSimd->arg_begin(), 2);
NewInvokeSimdArgs.append(ThirdArg, InvokeSimd->arg_end());
CallInst *NewInvokeSimd =
CallInst::Create(NewInvokeSimdF, NewInvokeSimdArgs, "", InvokeSimd);
CallInst *NewInvokeSimd = CallInst::Create(
NewInvokeSimdF, NewInvokeSimdArgs, "", InvokeSimd->getIterator());
// - transfer flags, attributes (with shrinking), calling convention:
NewInvokeSimd->copyIRFlags(InvokeSimd);
NewInvokeSimd->setCallingConv(InvokeSimd->getCallingConv());
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/LowerWGScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ Value *spirv::genPseudoLocalID(Instruction &Before, const Triple &TT) {
Align Alignment = M.getDataLayout().getPreferredAlign(G);
G->setAlignment(MaybeAlign(Alignment));
}
Value *Res = new LoadInst(G->getValueType(), G, "", &Before);
Value *Res = new LoadInst(G->getValueType(), G, "", Before.getIterator());
return Res;
}
}
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/SYCLLowerIR/SYCLConditionalCallOnDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SYCLConditionalCallOnDevicePass::run(Module &M, ModuleAnalysisManager &) {
// (FAction). FAction should be a literal (i.e. not a pointer). The
// structure of the header file ensures that there is exactly one such
// instruction.
bool CallFound = false;
[[maybe_unused]] bool CallFound = false;
for (Instruction &I : instructions(FCaller)) {
if (auto *CI = dyn_cast<CallInst>(&I);
CI && (Intrinsic::IndependentIntrinsics::not_intrinsic ==
Expand Down Expand Up @@ -121,8 +121,8 @@ SYCLConditionalCallOnDevicePass::run(Module &M, ModuleAnalysisManager &) {
Args.push_back(Call->getArgOperand(I));

// Create the new call instruction
auto *NewCall =
CallInst::Create(NewFCaller, Args, /* NameStr = */ "", Call);
auto *NewCall = CallInst::Create(NewFCaller, Args, /* NameStr = */ "",
Call->getIterator());
NewCall->setCallingConv(Call->getCallingConv());
NewCall->setDebugLoc(Call->getDebugLoc());

Expand Down
24 changes: 12 additions & 12 deletions llvm/lib/SYCLLowerIR/SpecConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,15 @@ Instruction *emitCall(Type *RetTy, StringRef BaseFunctionName,
auto *NewFT = FunctionType::get(NewRetTy, ArgTys, false /*isVarArg*/);
auto NewFC = M->getOrInsertFunction(FunctionName, NewFT);

auto *Call =
CallInst::Create(NewFT, NewFC.getCallee(), Args, "", InsertBefore);
auto *Call = CallInst::Create(NewFT, NewFC.getCallee(), Args, "",
InsertBefore->getIterator());
if (IsSPIROrSPIRV) {
cast<Function>(NewFC.getCallee())
->setCallingConv(CallingConv::SPIR_FUNC);
Call->setCallingConv(CallingConv::SPIR_FUNC);
}
return CastInst::CreateTruncOrBitCast(Call, RetTy, "tobool",
InsertBefore);
InsertBefore->getIterator());
}
}

Expand Down Expand Up @@ -711,22 +711,22 @@ Value *createLoadFromBuffer(CallInst *InsertBefore, Value *Buffer,
Type *Int32Ty = Type::getInt32Ty(C);
GetElementPtrInst *GEP = GetElementPtrInst::Create(
Int8Ty, Buffer, {ConstantInt::get(Int32Ty, Offset, false)}, "gep",
InsertBefore);
InsertBefore->getIterator());

Instruction *BitCast = nullptr;
if (SCType->isIntegerTy(1)) // No bitcast to i1 before load
BitCast = GEP;
else
BitCast =
new BitCastInst(GEP, PointerType::get(SCType, GEP->getAddressSpace()),
"bc", InsertBefore);
"bc", InsertBefore->getIterator());

// When we encounter i1 spec constant, we still load the whole byte
Value *Load = new LoadInst(SCType->isIntegerTy(1) ? Int8Ty : SCType, BitCast,
"load", InsertBefore);
"load", InsertBefore->getIterator());
if (SCType->isIntegerTy(1)) // trunc back to i1 if necessary
Load = CastInst::CreateIntegerCast(Load, SCType, /* IsSigned */ false,
"tobool", InsertBefore);
"tobool", InsertBefore->getIterator());

return Load;
}
Expand Down Expand Up @@ -993,8 +993,8 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
if (SCTy->isIntegerTy(1)) {
assert(DefaultValue->getType()->isIntegerTy(8) &&
"For bool spec constant default value is expected to be i8");
Replacement =
new TruncInst(DefaultValue, Type::getInt1Ty(Ctx), "bool", CI);
Replacement = new TruncInst(DefaultValue, Type::getInt1Ty(Ctx),
"bool", CI->getIterator());
} else
Replacement = DefaultValue;
}
Expand All @@ -1021,9 +1021,9 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
Value *ArraySize =
Mode == HandlingMode::emulation ? DefaultValue : Replacement;
assert(ArraySize->getType()->isIntegerTy() && "Expecting integer type");
Replacement =
new AllocaInst(Intr->getAllocatedType(), Intr->getAddressSpace(),
ArraySize, Intr->getAlign(), "alloca", CI);
Replacement = new AllocaInst(
Intr->getAllocatedType(), Intr->getAddressSpace(), ArraySize,
Intr->getAlign(), "alloca", CI->getIterator());
}

if (HasSretParameter)
Expand Down
Loading

0 comments on commit a3b0487

Please sign in to comment.