-
Notifications
You must be signed in to change notification settings - Fork 43
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
Multiplication of some types with Rational
causes compiler error
#570
Comments
I'll defer to someone more familiar with the compiler stuff on if a fix is possible, but this seems similar to #287. Can you use |
Unlikely, since we already detect those in GPUCompiler: https://github.com/JuliaGPU/GPUCompiler.jl/blob/1de83c11f8acc572ea2e563fe69a458fb34c70ec/src/metal.jl#L119-L120 |
Back-end error:
Minimal LLVM IR: target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
target triple = "air64-apple-macosx15.3.2"
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.smul.with.overflow.i64(i64, i64) #0
define void @_Z16broadcast_linear14MtlDeviceArrayI8RationalI5Int64ELi1ELi1EE11BroadcastedI13MtlArrayStyleILi1E14PrivateStorageE5TupleI5OneToIS1_EE2_1S8_I8ExtrudedIS_IS1_Li1ELi1EES8_I4BoolES8_IS1_EEEE({ i8 addrspace(1)*, [1 x i64] } addrspace(1)* %0) {
conversion:
%1 = alloca [0 x [0 x [2 x i64]]], i32 0, align 8
%2 = getelementptr [0 x [0 x [2 x i64]]], [0 x [0 x [2 x i64]]]* %1, i64 0, i64 0, i64 0, i64 0
%3 = load i64, i64* %2, align 8
%4 = call { i64, i1 } @llvm.smul.with.overflow.i64(i64 %3, i64 %3)
%5 = extractvalue { i64, i1 } %4, 1
call void @llvm.assume(i1 %5)
%6 = extractvalue { i64, i1 } %4, 0
store i64 %6, i64 addrspace(1)* null, align 4294967296
ret void
}
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite)
declare void @llvm.assume(i1 noundef) #1
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
!air.kernel = !{!0}
!air.version = !{!7}
!0 = !{void ({ i8 addrspace(1)*, [1 x i64] } addrspace(1)*, { [1 x { { i8 addrspace(1)*, [1 x i64] }, [1 x i8], [1 x i64] }], [1 x [1 x i64]] } addrspace(1)*, i32, i32)* bitcast (void ({ i8 addrspace(1)*, [1 x i64] } addrspace(1)*)* @_Z16broadcast_linear14MtlDeviceArrayI8RationalI5Int64ELi1ELi1EE11BroadcastedI13MtlArrayStyleILi1E14PrivateStorageE5TupleI5OneToIS1_EE2_1S8_I8ExtrudedIS_IS1_Li1ELi1EES8_I4BoolES8_IS1_EEEE to void ({ i8 addrspace(1)*, [1 x i64] } addrspace(1)*, { [1 x { { i8 addrspace(1)*, [1 x i64] }, [1 x i8], [1 x i64] }], [1 x [1 x i64]] } addrspace(1)*, i32, i32)*), !1, !2}
!1 = !{}
!2 = !{!3, !4, !5, !6}
!3 = !{i32 0, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"MtlDeviceVector{Rational{Int64}, 1}", !"air.arg_name", !"dest"}
!4 = !{i32 1, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.arg_type_size", i32 40, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"Base.Broadcast.Broadcasted{Metal.MtlArrayStyle{1, Metal.PrivateStorage}, Tuple{Base.OneTo{Int64}}, var\22#1#2\22, Tuple{Base.Broadcast.Extruded{MtlDeviceVector{Int64, 1}, Tuple{Bool}, Tuple{Int64}}}}", !"air.arg_name", !"bc"}
!5 = !{i32 2, !"air.threads_per_grid", !"air.arg_type_name", !"uint"}
!6 = !{i32 3, !"air.thread_position_in_grid", !"air.arg_type_name", !"uint"}
!7 = !{i32 2, i32 5, i32 0} So probably |
This seems to be separate from #550 since this is a compiler rather than type error?
When multiplying integers or rationals with a
Rational
, the function fails to compile.Here's the additional files the error message asks for:
https://drive.google.com/drive/folders/1ipHy4p6DEiKgCJWbTHtqcf1vGKNzQxqq?usp=sharing
The text was updated successfully, but these errors were encountered: