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

ObjectiveC.Foundation.NSErrorInstance(ObjectiveC.id{ObjectiveC.Foundation.NSError}(0x000000014cb8bd90)) #487

Closed
efaulhaber opened this issue Dec 2, 2024 · 2 comments

Comments

@efaulhaber
Copy link

With the PR branch of #480, I could run my kernel without errors. Now that it is merged, I ]added the master/main branches of Metal.jl and GPUCompiler.jl, and got the following error with the same kernel:

ERROR: Compilation to native code failed; see below for details.
If you think this is a bug, please file an issue and attach the following files:
- /var/folders/gx/ckq0xt295kxgf7ygv1xxprhr0000gn/T/jl_eHAxYr2JKJ.ll
- /var/folders/gx/ckq0xt295kxgf7ygv1xxprhr0000gn/T/jl_ejmPu963C3.air
- /var/folders/gx/ckq0xt295kxgf7ygv1xxprhr0000gn/T/jl_ITaDoNSHU5.metallib
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/compilation.jl:206 [inlined]
  [3] macro expansion
    @ ~/.julia/packages/ObjectiveC/C7BVt/src/os.jl:264 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/compilation.jl:183 [inlined]
  [5] (::Metal.var"#172#173"{Bool, GPUCompiler.CompilerJob{…}, @NamedTuple{…}})()
    @ Metal ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:637
  [6] macro expansion
    @ ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:565 [inlined]
  [7] macro expansion
    @ ./lock.jl:273 [inlined]
  [8] ObjectiveC.Foundation.NSAutoreleasePool(f::Metal.var"#172#173"{Bool, GPUCompiler.CompilerJob{…}, @NamedTuple{…}})
    @ ObjectiveC.Foundation ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:557
  [9] link(job::GPUCompiler.CompilerJob, compiled::@NamedTuple{…}; return_function::Bool)
    @ Metal ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:636
 [10] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(Metal.compile), linker::typeof(Metal.link))
    @ GPUCompiler ~/.julia/packages/GPUCompiler/GnbhK/src/execution.jl:262
 [11] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/GnbhK/src/execution.jl:151
 [12] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:189 [inlined]
 [13] macro expansion
    @ ./lock.jl:273 [inlined]
 [14] mtlfunction(f::typeof(PointNeighbors.gpu_generic_kernel), tt::Type{Tuple{…}}; name::Nothing, kwargs::@Kwargs{})
    @ Metal ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:184
 [15] mtlfunction(f::typeof(PointNeighbors.gpu_generic_kernel), tt::Type{Tuple{…}})
    @ Metal ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:182
 [16] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:85 [inlined]
 [17] (::KernelAbstractions.Kernel{…})(args::Function; ndrange::Int64, workgroupsize::Nothing)
    @ Metal.MetalKernels ~/.julia/packages/Metal/6SEqe/src/MetalKernels.jl:110
 [18] Kernel
    @ ~/.julia/packages/Metal/6SEqe/src/MetalKernels.jl:106 [inlined]
 [19] parallel_foreach
    @ ~/git/PointNeighbors.jl/src/util.jl:147 [inlined]
 [20] macro expansion
    @ ~/git/PointNeighbors.jl/src/util.jl:103 [inlined]
 [21] foreach_point_neighbor
    @ ~/git/PointNeighbors.jl/src/neighborhood_search.jl:186 [inlined]
 [22] #foreach_point_neighbor#18
    @ ~/git/PointNeighbors.jl/src/neighborhood_search.jl:161 [inlined]
 [23] foreach_point_neighbor
    @ ~/git/PointNeighbors.jl/src/neighborhood_search.jl:142 [inlined]
 [24] #foreach_point_neighbor#168
    @ ~/git/TrixiParticles.jl/src/general/neighborhood_search.jl:20 [inlined]
 [25] foreach_point_neighbor
    @ ~/git/TrixiParticles.jl/src/general/neighborhood_search.jl:13 [inlined]
 [26] interact!
    @ ~/git/TrixiParticles.jl/src/schemes/fluid/weakly_compressible_sph/rhs.jl:23 [inlined]
 [27] var"##core#283"(dv#256::MtlMatrix{…}, v#257::MtlMatrix{…}, u#258::MtlMatrix{…}, v#259::MtlMatrix{…}, u#260::MtlMatrix{…}, nhs#261::GridNeighborhoodSearch{…}, system#262::WeaklyCompressibleSPHSystem{…}, system#263::WeaklyCompressibleSPHSystem{…})
    @ Main ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:561
 [28] var"##sample#284"(::Tuple{…}, __params::BenchmarkTools.Parameters)
    @ Main ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:570
 [29] _lineartrial(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters; maxevals::Int64, kwargs::@Kwargs{})
    @ BenchmarkTools ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:187
 [30] _lineartrial(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters)
    @ BenchmarkTools ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:182
 [31] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
 [32] invokelatest
    @ ./essentials.jl:1052 [inlined]
 [33] #lineartrial#46
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:51 [inlined]
 [34] lineartrial
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:50 [inlined]
 [35] tune!(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters; progressid::Nothing, nleaves::Float64, ndone::Float64, verbose::Bool, pad::String, kwargs::@Kwargs{})
    @ BenchmarkTools ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:300
 [36] tune! (repeats 2 times)
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:289 [inlined]
 [37] macro expansion
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:447 [inlined]
 [38] benchmark_wcsph_fp32(neighborhood_search::GridNeighborhoodSearch{…}, coordinates_::Matrix{…}; parallel::MetalBackend)
    @ Main ~/git/PointNeighbors.jl/benchmarks/smoothed_particle_hydrodynamics.jl:110
 [39] plot_benchmarks(benchmark::typeof(benchmark_wcsph_fp32), n_points_per_dimension::Tuple{…}, iterations::Int64; parallel::MetalBackend, title::String, seed::Int64, perturbation_factor_position::Float64)
    @ Main ~/git/PointNeighbors.jl/benchmarks/plot.jl:133
 [40] top-level scope
    @ REPL[1]:1
Some type information was truncated. Use `show(err)` to see complete types.

caused by: ObjectiveC.Foundation.NSErrorInstance(ObjectiveC.id{ObjectiveC.Foundation.NSError}(0x000000014cb8bd90))
Stacktrace:
  [1] Metal.MTL.MTLComputePipelineState(dev::Metal.MTL.MTLDeviceInstance, fun::Metal.MTL.MTLFunctionInstance)
    @ Metal.MTL ~/.julia/packages/Metal/6SEqe/lib/mtl/compute_pipeline.jl:60
  [2] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/compilation.jl:188 [inlined]
  [3] macro expansion
    @ ~/.julia/packages/ObjectiveC/C7BVt/src/os.jl:264 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/compilation.jl:183 [inlined]
  [5] (::Metal.var"#172#173"{Bool, GPUCompiler.CompilerJob{…}, @NamedTuple{…}})()
    @ Metal ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:637
  [6] macro expansion
    @ ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:565 [inlined]
  [7] macro expansion
    @ ./lock.jl:273 [inlined]
  [8] ObjectiveC.Foundation.NSAutoreleasePool(f::Metal.var"#172#173"{Bool, GPUCompiler.CompilerJob{…}, @NamedTuple{…}})
    @ ObjectiveC.Foundation ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:557
  [9] link(job::GPUCompiler.CompilerJob, compiled::@NamedTuple{…}; return_function::Bool)
    @ Metal ~/.julia/packages/ObjectiveC/C7BVt/src/foundation.jl:636
 [10] actual_compilation(cache::Dict{…}, src::Core.MethodInstance, world::UInt64, cfg::GPUCompiler.CompilerConfig{…}, compiler::typeof(Metal.compile), linker::typeof(Metal.link))
    @ GPUCompiler ~/.julia/packages/GPUCompiler/GnbhK/src/execution.jl:262
 [11] cached_compilation(cache::Dict{…}, src::Core.MethodInstance, cfg::GPUCompiler.CompilerConfig{…}, compiler::Function, linker::Function)
    @ GPUCompiler ~/.julia/packages/GPUCompiler/GnbhK/src/execution.jl:151
 [12] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:189 [inlined]
 [13] macro expansion
    @ ./lock.jl:273 [inlined]
 [14] mtlfunction(f::typeof(PointNeighbors.gpu_generic_kernel), tt::Type{Tuple{…}}; name::Nothing, kwargs::@Kwargs{})
    @ Metal ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:184
 [15] mtlfunction(f::typeof(PointNeighbors.gpu_generic_kernel), tt::Type{Tuple{…}})
    @ Metal ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:182
 [16] macro expansion
    @ ~/.julia/packages/Metal/6SEqe/src/compiler/execution.jl:85 [inlined]
 [17] (::KernelAbstractions.Kernel{…})(args::Function; ndrange::Int64, workgroupsize::Nothing)
    @ Metal.MetalKernels ~/.julia/packages/Metal/6SEqe/src/MetalKernels.jl:110
 [18] Kernel
    @ ~/.julia/packages/Metal/6SEqe/src/MetalKernels.jl:106 [inlined]
 [19] parallel_foreach
    @ ~/git/PointNeighbors.jl/src/util.jl:147 [inlined]
 [20] macro expansion
    @ ~/git/PointNeighbors.jl/src/util.jl:103 [inlined]
 [21] foreach_point_neighbor
    @ ~/git/PointNeighbors.jl/src/neighborhood_search.jl:186 [inlined]
 [22] #foreach_point_neighbor#18
    @ ~/git/PointNeighbors.jl/src/neighborhood_search.jl:161 [inlined]
 [23] foreach_point_neighbor
    @ ~/git/PointNeighbors.jl/src/neighborhood_search.jl:142 [inlined]
 [24] #foreach_point_neighbor#168
    @ ~/git/TrixiParticles.jl/src/general/neighborhood_search.jl:20 [inlined]
 [25] foreach_point_neighbor
    @ ~/git/TrixiParticles.jl/src/general/neighborhood_search.jl:13 [inlined]
 [26] interact!
    @ ~/git/TrixiParticles.jl/src/schemes/fluid/weakly_compressible_sph/rhs.jl:23 [inlined]
 [27] var"##core#283"(dv#256::MtlMatrix{…}, v#257::MtlMatrix{…}, u#258::MtlMatrix{…}, v#259::MtlMatrix{…}, u#260::MtlMatrix{…}, nhs#261::GridNeighborhoodSearch{…}, system#262::WeaklyCompressibleSPHSystem{…}, system#263::WeaklyCompressibleSPHSystem{…})
    @ Main ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:561
 [28] var"##sample#284"(::Tuple{…}, __params::BenchmarkTools.Parameters)
    @ Main ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:570
 [29] _lineartrial(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters; maxevals::Int64, kwargs::@Kwargs{})
    @ BenchmarkTools ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:187
 [30] _lineartrial(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters)
    @ BenchmarkTools ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:182
 [31] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
 [32] invokelatest
    @ ./essentials.jl:1052 [inlined]
 [33] #lineartrial#46
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:51 [inlined]
 [34] lineartrial
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:50 [inlined]
 [35] tune!(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters; progressid::Nothing, nleaves::Float64, ndone::Float64, verbose::Bool, pad::String, kwargs::@Kwargs{})
    @ BenchmarkTools ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:300
 [36] tune! (repeats 2 times)
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:289 [inlined]
 [37] macro expansion
    @ ~/.julia/packages/BenchmarkTools/QNsku/src/execution.jl:447 [inlined]
 [38] benchmark_wcsph_fp32(neighborhood_search::GridNeighborhoodSearch{…}, coordinates_::Matrix{…}; parallel::MetalBackend)
    @ Main ~/git/PointNeighbors.jl/benchmarks/smoothed_particle_hydrodynamics.jl:110
 [39] plot_benchmarks(benchmark::typeof(benchmark_wcsph_fp32), n_points_per_dimension::Tuple{…}, iterations::Int64; parallel::MetalBackend, title::String, seed::Int64, perturbation_factor_position::Float64)
    @ Main ~/git/PointNeighbors.jl/benchmarks/plot.jl:133
 [40] top-level scope
    @ REPL[1]:1
Some type information was truncated. Use `show(err)` to see complete types.

The mentioned files: Archive.zip

@maleadt
Copy link
Member

maleadt commented Dec 2, 2024

caused by: ObjectiveC.Foundation.NSErrorInstance(ObjectiveC.id{ObjectiveC.Foundation.NSError}(0x000000014cb8bd90))

That error is not helpful. I wonder why it's being rendered as such on your system; normally NSError instances will render nicely, even when thrown in exactly the same way Metal.jl does:

julia> try
       throw(NSError("NSPOSIXErrorDomain", 1))
       catch err
       error("test")
       end
ERROR: test
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] top-level scope
   @ REPL[6]:4

caused by: NSError: The operation couldn’t be completed. Operation not permitted (NSPOSIXErrorDomain, code 1)
Failure reason: Operation not permitted
Stacktrace:
 [1] top-level scope
   @ REPL[6]:2

What environment are you executing this in, and/or have you any special logging configured, or packages loaded?
What version of ObjectiveC.jl is in your manifest?

@efaulhaber
Copy link
Author

Just updated my packages and rerun the same code. Now it's working... Idk what happened.

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

No branches or pull requests

2 participants