Conversation
| @assert shardy_passes in [:none, :to_mhlo_shardings, :post_sdy_propagation] | ||
| end | ||
|
|
||
| emulate_complex_val = emulate_complex === nothing ? (client === nothing ? false : !XLA.supports_complex(client)) : emulate_complex |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| emulate_complex_val = emulate_complex === nothing ? (client === nothing ? false : !XLA.supports_complex(client)) : emulate_complex | |
| emulate_complex_val = if emulate_complex === nothing | |
| (client === nothing ? false : !XLA.supports_complex(client)) | |
| else | |
| emulate_complex | |
| end |
| mod = MLIR.IR.Module(MLIR.IR.Location()) | ||
|
|
||
| compile_options, kwargs_inner = __get_compile_options_and_kwargs(; kwargs...) | ||
| compile_options, kwargs_inner = __get_compile_options_and_kwargs(; client, kwargs...) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| compile_options, kwargs_inner = __get_compile_options_and_kwargs(; client, kwargs...) | |
| compile_options, kwargs_inner = __get_compile_options_and_kwargs(; | |
| client, kwargs... | |
| ) |
| @test c == ones(ComplexF32, 2) + ones(ComplexF32, 2) | ||
| end | ||
| end | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| client::Client, array::Base.StridedArray{T,N}, sharding | ||
| ) where {T<:Reactant.ReactantPrimitive,N} | ||
| if T <: Complex && !XLA.supports_complex(client) | ||
| @assert sharding isa Reactant.Sharding.NoSharding || sharding isa Reactant.Sharding.Replicated |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| @assert sharding isa Reactant.Sharding.NoSharding || sharding isa Reactant.Sharding.Replicated | |
| @assert sharding isa Reactant.Sharding.NoSharding || | |
| sharding isa Reactant.Sharding.Replicated |
| MLIR.API.UninitPJRTBuffer( | ||
| client.client, | ||
| device.device, | ||
| XLA.primitive_type(S), | ||
| length(dims), | ||
| collect(Int64, reverse(dims)), | ||
| ptype, | ||
| ndims, | ||
| sizear, | ||
| ), |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| MLIR.API.UninitPJRTBuffer( | |
| client.client, | |
| device.device, | |
| XLA.primitive_type(S), | |
| length(dims), | |
| collect(Int64, reverse(dims)), | |
| ptype, | |
| ndims, | |
| sizear, | |
| ), | |
| MLIR.API.UninitPJRTBuffer(client.client, device.device, ptype, ndims, sizear) |
|
|
||
| result = try | ||
| process_linear_args!(linear_args, fnbody, do_transpose, optimize_then_pad, inv_map) | ||
| process_linear_args!(linear_args, fnbody, do_transpose, optimize_then_pad, inv_map, emulate_complex) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| process_linear_args!(linear_args, fnbody, do_transpose, optimize_then_pad, inv_map, emulate_complex) | |
| process_linear_args!( | |
| linear_args, | |
| fnbody, | |
| do_transpose, | |
| optimize_then_pad, | |
| inv_map, | |
| emulate_complex, | |
| ) |
| end | ||
|
|
||
| function process_linear_args!(linear_args, fnbody, do_transpose, optimize_then_pad, inv_map) | ||
| function process_linear_args!(linear_args, fnbody, do_transpose, optimize_then_pad, inv_map, emulate_complex) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| function process_linear_args!(linear_args, fnbody, do_transpose, optimize_then_pad, inv_map, emulate_complex) | |
| function process_linear_args!( | |
| linear_args, fnbody, do_transpose, optimize_then_pad, inv_map, emulate_complex | |
| ) |
| end | ||
| end | ||
| set_mlir_data!(arg, row_maj_arg) | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
|
|
||
| start_real = ones(Int, N+1) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| start_real = ones(Int, N+1) | |
| start_real = ones(Int, N + 1) |
| start_real = ones(Int, N+1) | ||
| limit_real = collect(Int, sz) | ||
| pushfirst!(limit_real, 1) | ||
| start_imag = ones(Int, N+1) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| start_imag = ones(Int, N+1) | |
| start_imag = ones(Int, N + 1) |
|
|
||
| traced_raw = TracedRArray{T2, N+1}((), row_maj_arg, (2, sz...)) | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| traced_raw = TracedRArray{T2, N+1}((), row_maj_arg, (2, sz...)) | |
| traced_raw = TracedRArray{T2,N + 1}((), row_maj_arg, (2, sz...)) | |
|
|
||
| real_slice = Ops.slice(traced_raw, start_real, limit_real) | ||
| imag_slice = Ops.slice(traced_raw, start_imag, limit_imag) | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
|
|
||
| real_part = Ops.reshape(real_slice, sz...) | ||
| imag_part = Ops.reshape(imag_slice, sz...) | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| (; sym_name, mesh_attr) = mesh_cache[key] | ||
| T = Reactant.unwrapped_eltype(arg) | ||
| if T <: Complex && emulate_complex | ||
| sharding = Reactant.adapt_sharding_for_emulated_complex(sharding, ndims(arg)) |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| sharding = Reactant.adapt_sharding_for_emulated_complex(sharding, ndims(arg)) | |
| sharding = Reactant.adapt_sharding_for_emulated_complex( | |
| sharding, ndims(arg) | |
| ) |
| end | ||
| return true | ||
| end | ||
|
|
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| finalize(mod) | ||
|
|
||
| return exec, hlo_modules, mlir_fn_res, device, client, module_string | ||
| return exec, hlo_modules, mlir_fn_res, device, client, module_string, compile_options |
There was a problem hiding this comment.
[JuliaFormatter] reported by reviewdog 🐶
| return exec, hlo_modules, mlir_fn_res, device, client, module_string, compile_options | |
| return exec, | |
| hlo_modules, mlir_fn_res, device, client, module_string, | |
| compile_options |
mofeing
left a comment
There was a problem hiding this comment.
lgtm, but don't we take the size for some TracedRArray from MLIR's type inference for some op in Ops? in such case, it would we wrong for emulated complex
No description provided.