Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: adapt to sroa jll #521

Merged
merged 15 commits into from
Jan 16, 2025
Merged

WIP: adapt to sroa jll #521

merged 15 commits into from
Jan 16, 2025

Conversation

wsmoses
Copy link
Member

@wsmoses wsmoses commented Jan 13, 2025

Comment on lines +298 to +300
passes = [
"inline{default-pipeline=canonicalize max-iterations=4}"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
passes = [
"inline{default-pipeline=canonicalize max-iterations=4}"
]
passes = ["inline{default-pipeline=canonicalize max-iterations=4}"]

Comment on lines +302 to +304
push!(passes, "sroa-wrappers")
push!(passes, "libdevice-funcs-raise")
push!(passes, "canonicalize")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
push!(passes, "sroa-wrappers")
push!(passes, "libdevice-funcs-raise")
push!(passes, "canonicalize")
push!(passes, "sroa-wrappers")
push!(passes, "libdevice-funcs-raise")
push!(passes, "canonicalize")

Comment on lines +307 to 309
return join(passes,
',',
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
return join(passes,
',',
)
return join(passes, ',')

@@ -379,12 +385,20 @@ function compile_mlir!(mod, f, args; optimize::Union{Bool,Symbol}=true, no_nan::
if isdefined(Reactant_jll, :ptxas_path)
toolkit = Reactant_jll.ptxas_path[1:(end - length("/bin/ptxas"))]
end
kern = "lower-kernel{run_init=true toolkitPath=$toolkit cuLaunchKernelPtr=$(cuLaunch[]) cuModuleLoadDataPtr=$(cuModule[]) cuModuleGetFunctionPtr=$(cuFunc[])},symbol-dce"
if DEBUG_KERNEL[]
curesulthandler = XLA.Libdl.dlsym(Reactant_jll.libReactantExtra_handle, "ReactantHandleCuResult")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
curesulthandler = XLA.Libdl.dlsym(Reactant_jll.libReactantExtra_handle, "ReactantHandleCuResult")
curesulthandler = XLA.Libdl.dlsym(
Reactant_jll.libReactantExtra_handle, "ReactantHandleCuResult"
)

@@ -318,6 +318,18 @@ function Base.showerror(io::IO, err::NoFieldMatchError)
)
end

function make_tracer(
seen,
@nospecialize(prev::Union{Base.ExceptionStack, Core.MethodInstance}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@nospecialize(prev::Union{Base.ExceptionStack, Core.MethodInstance}),
@nospecialize(prev::Union{Base.ExceptionStack,Core.MethodInstance}),

@@ -2,6 +2,9 @@ using Reactant
using Reactant: Ops

using Test

# Jax on Github CI dislikes X86 macos
@static if !Sys.isapple() || Sys.ARCH != :x86_64
using PythonCall
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
using PythonCall
using PythonCall

@@ -11,3 +14,4 @@ using PythonCall
@test typeof(result) == ConcreteRNumber{Float32}
@test result 6
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

@testset "PythonCall" begin
jax = pyimport("jax")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

result = @jit jax.numpy.sum(Reactant.to_rarray(Float32[1, 2, 3]))
@test typeof(result) == ConcreteRNumber{Float32}
@test result 6

@@ -425,6 +428,7 @@ function get_field_offset(T::Type, path)
offset = 0
current_type = T


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change


# Update current_type to the field's type for next iteration
current_type = fieldtype(current_type, field_idx)
current_type = tcurrent_type

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

@@ -461,6 +469,10 @@ Reactant.@reactant_overlay @noinline function (func::LLVMFunc{F,tt})(
blockdim = CUDA.CuDim3(blocks)
threaddim = CUDA.CuDim3(threads)

if convert == Val(true)
args = recudaconvert.(args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
args = recudaconvert.(args)
args = recudaconvert.(args)

@@ -650,6 +662,7 @@ Reactant.@reactant_overlay @noinline function (func::LLVMFunc{F,tt})(
end

location = MLIR.IR.Location()
@assert length(restys) == length(aliases)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@assert length(restys) == length(aliases)
@assert length(restys) == length(aliases)

@wsmoses wsmoses merged commit a1f93a0 into main Jan 16, 2025
2 of 10 checks passed
@wsmoses wsmoses deleted the sroa branch January 16, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant