-
Notifications
You must be signed in to change notification settings - Fork 112
remove usingnamespace from mlir #204
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
Conversation
# Conflicts: # mlir/dialects/arith.zig # mlir/dialects/func.zig # mlir/dialects/stablehlo.zig # mlir/mlir.zig # zml/mlir.zig # zml/module.zig # zml/nn/cuda.zig # zml/ops.zig # zml/tensor.zig
I tried to remove usingnamespace from ZML and it's deps. Even though `-fincremental` works now, it doesn't provide improved compilation speed. I guess because our compilation time are dominated by the linking of all our C++ deps, and the linking isn't incremental ATM. I split this in 3 pull requests, I find the code a bit uglier everywhere, not sure if it's worth it. * floats.zig this PR * mlir.zig #204 * asyncio.zig #205
# Conflicts: # mlir/dialects/func.zig # mlir/dialects/stablehlo.zig # mlir/mlir.zig # zml/module.zig # zml/nn/cuda.zig # zml/ops.zig # zml/tensor.zig
35fac87 to
5010e43
Compare
648760e to
0c3d245
Compare
33cce1f to
f678ba8
Compare
# Conflicts: # zml/ops.zig
| } | ||
| }).cb, &local_context, &res); | ||
| assert(local_context.index == op.numResults()); | ||
| std.debug.assert(local_context.index == op.numResults()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking but I've been thinking that we might need to replace all std.debut.assert with stdx.debug.assert and an error message of why we assert it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general yes. not 100% sure what this one is checking and if it can be triggered by the user or if it's an internal assertion that visit is working.
| .{ "window_dilations", .dense(ctx.mlirCtx(), .i64, opts.window_dilations) }, | ||
| .{ "padding", .denseElements(ctx.mlirCtx(), &.{ @intCast(opts.padding.len), 2 }, .i64, opts.padding) }, | ||
| // Cast the [][2]i64 to []i64 (safe) | ||
| .{ "padding", .denseElements(ctx.mlirCtx(), &.{ @intCast(opts.padding.len), 2 }, .i64, @ptrCast(opts.padding)) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's safe, pointers are compatible but length are not, no ?
[]i64 should have twice as many elements at [][2]i64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zig does the right thing here. I doubled checked with the following test snippet:
test ReduceWindowOpts {
const opt: ReduceWindowOpts = .{
.window_dimensions = &.{},
.window_strides = &.{},
.base_dilations = &.{},
.window_dilations = &.{},
.padding = &.{ .{ 10, 2 }, .{ 3, 5 } },
};
try std.testing.expectEqual(2, opt.padding.len);
try std.testing.expectEqual(4, @as([]const i64, @ptrCast(opt.padding)).len);
}
No description provided.