We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b0e7b5 commit fe00905Copy full SHA for fe00905
src/device/intrinsics/output.jl
@@ -50,6 +50,19 @@ end
50
end
51
52
53
+function valist_size(dl, param_types)
54
+ size = 0
55
+ for pty in param_types
56
+ ps = sizeof(dl, pty)
57
+ if size % ps == 0
58
+ size += ps
59
+ else
60
+ size += (size % ps) + ps
61
+ end
62
63
+
64
+ return size
65
+end
66
67
"""
68
@mtlprintf("%Fmt", args...)
@@ -99,9 +112,8 @@ end
99
112
log_type = LLVM.ConstantInt(T_int32, __METAL_OS_LOG_TYPE_DEBUG__)
100
113
101
114
# compute argsize
102
- argtypes = LLVM.StructType(param_types)
103
- dl = datalayout(mod)
104
- arg_size = LLVM.ConstantInt(T_int64, sizeof(dl, argtypes))
115
+ dl = datalayout(mod)
116
+ arg_size = LLVM.ConstantInt(T_int64, valist_size(dl, param_types))
105
117
106
118
alloc = alloca!(builder, T_pint8)
107
119
buffer = bitcast!(builder, alloc, T_pint8)
0 commit comments