Skip to content
Open
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
1 change: 1 addition & 0 deletions src/compiler/Compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ function compile_xla(
num_replicas=mlir_fn_res.num_replicas,
num_partitions=mlir_fn_res.num_partitions,
mesh_ids=mlir_fn_res.is_sharded ? global_device_ids : nothing,
platform=lowercase(XLA.platform_name(client)),
xla_debug_options=compile_options.xla_debug_options,
xla_executable_build_options=merge(
(;
Expand Down
18 changes: 16 additions & 2 deletions src/xla/CompileOptions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,25 @@ function get_default_compile_options()
return proto
end

function get_debug_options(; kwargs...)
function get_debug_options(; platform::String="", kwargs...)
debug_options = get_default_debug_options()

# default overrides. can we changed by the user by passing in kwargs
@set! debug_options.xla_gpu_cuda_data_dir = CUDA_DATA_DIR[]
@set! debug_options.xla_enable_enzyme_comms_opt = true
@set! debug_options.xla_gpu_experimental_use_raft_select_k = true

if platform == "rocm"
# HIP graph replay of command buffers segfaults inside the HSA runtime
# on current ROCm stacks (deterministically, in the first execution of
# a while-loop command buffer). Default them off until that is fixed
# upstream; the user override below still wins.
# https://gist.github.com/ftynse/5c3816a1cea5daa7dc189b937b62f9ca (issue 6)
@set! debug_options.xla_gpu_enable_command_buffer = Vector{
Reactant.Proto.xla.var"DebugOptions.CommandBufferCmdType".T
}()
end

if Reactant.PersistentCompileCache.kernel_cache_enabled()
@set! debug_options.xla_gpu_kernel_cache_file = Reactant.PersistentCompileCache.get_kernel_cache_path()
@set! debug_options.xla_gpu_enable_llvm_module_compilation_parallelism = true
Expand Down Expand Up @@ -70,14 +81,17 @@ function make_compile_options(;
num_replicas::Int64=1,
num_partitions::Int64=1,
mesh_ids::Union{Vector{Int64},Nothing}=nothing,
platform::String="",
xla_debug_options=(;),
xla_executable_build_options=(;),
xla_compile_options=(;),
)
compile_options = get_default_compile_options()
executable_build_options = compile_options.executable_build_options

@set! executable_build_options.debug_options = get_debug_options(; xla_debug_options...)
@set! executable_build_options.debug_options = get_debug_options(;
platform, xla_debug_options...
)
@set! executable_build_options.num_replicas = num_replicas
@set! executable_build_options.num_partitions = num_partitions

Expand Down
1 change: 1 addition & 0 deletions src/xla/IFRT/Array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ function replicate_array_to_all_devices(array::Array, sharding, mesh, size_arr)
device_id=-1,
num_partitions=length(mesh.device_ids),
mesh_ids=vec(mesh.device_ids),
platform=lowercase(XLA.platform_name(XLA.client(array))),
xla_executable_build_options=(;
use_shardy_partitioner=true, use_spmd_partitioning=true
),
Expand Down
Loading