Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/compiler/compilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,19 @@ end
throw(ArgumentError("Sub-group size $sub_group_size is not supported by this device, which supports $(join(sizes, ", "))"))
end

# SPIR-V codegen path. The Aurora LTS NEO/IGC runtime only accepts SPIR-V from the
# Khronos translator; the rolling stack uses the LLVM SPIR-V back-end. GPUCompiler picks
# the tool from the target's `backend` field and loads the JLL lazily, so both can be
# listed as deps and the choice is made here at compile time. Either way the extensions
# below have to be declared explicitly; the ones that atomics need are added by
# GPUCompiler based on `atomics`.
# The extensions below have to be declared explicitly; the ones that atomics need are
# added by GPUCompiler based on `atomics`.
# TODO: emit printf format strings in constant memory
extensions = String[
"SPV_EXT_relaxed_printf_string_address_space",
]
backend = :llvm
if oneL0.LTS[]
backend = :khronos
# The LTS SPIR-V stack cannot codegen native bfloat in generic kernels (clamp! ->
# InvalidIRError, and SPV_KHR_bfloat16 segfaults NEO), so keep bf16 off entirely on
# this path; the test suite gates bf16 eltypes on `!oneL0.LTS[]` to match.
supports_bfloat16 = false
else
backend = :llvm
supports_bfloat16 = _driver_supports_bfloat16_spirv(dev)
if supports_bfloat16
push!(extensions, "SPV_KHR_bfloat16")
Expand Down
15 changes: 4 additions & 11 deletions src/compiler/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ using PrecompileTools: @compile_workload
# Warm up the GPUCompiler -> SPIR-V pipeline during precompilation so the first real
# `zefunction` call is cheap. This doesn't need a GPU: SPIR-V codegen is device-independent
# (the target only carries version/extension/capability knobs), and the workload never
# launches anything. It is gated on the SPIR-V tool for the selected codegen path being
# available so the package still precompiles on platforms/toolchains without it.
#
# The workload mirrors the runtime backend choice (see `_compiler_config`): the LTS stack
# compiles through the Khronos translator, the rolling stack through the LLVM SPIR-V
# back-end. `oneL0.__init__` has not run at precompile time, so resolve ONEAPI_LTS
# directly from the environment with the same parser.
const _precompile_lts = oneL0.parse_env_bool("ONEAPI_LTS", false)
if _precompile_lts ? SPIRV_LLVM_Translator_jll.is_available() :
SPIRV_LLVM_Backend_jll.is_available()
# launches anything. It is gated on the SPIR-V back-end being available so the package
# still precompiles on platforms/toolchains without it.
if SPIRV_LLVM_Backend_jll.is_available()
@compile_workload begin
let
function _precompile_kernel(a)
Expand All @@ -24,7 +17,7 @@ if _precompile_lts ? SPIRV_LLVM_Translator_jll.is_available() :
# these knobs from the device; here we use conservative, portable defaults (the
# workload only exercises the pipeline, it does not target a specific device).
target = SPIRVCompilerTarget(;
backend = (_precompile_lts ? :khronos : :llvm),
backend = :llvm,
extensions = "", supports_fp16 = true,
supports_fp64 = true, supports_bfloat16 = false, driver = :intel,
)
Expand Down
Loading