Repository navigation
remove usingnamespace from mlir - #204
Merged
Merged
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
hugomano
pushed a commit
that referenced
this pull request
Mar 18, 2025
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
gwenzek
force-pushed
the
gw/no_using_mlir
branch
from
April 10, 2025 09:27
35fac87 to
5010e43
Compare
gwenzek
force-pushed
the
gw/no_using_mlir
branch
from
June 10, 2025 07:41
648760e to
0c3d245
Compare
gwenzek
force-pushed
the
gw/no_using_mlir
branch
from
June 10, 2025 07:55
33cce1f to
f678ba8
Compare
# Conflicts: # zml/ops.zig
Corendos
approved these changes
Jun 10, 2025
| } | ||
| }).cb, &local_context, &res); | ||
| assert(local_context.index == op.numResults()); | ||
| std.debug.assert(local_context.index == op.numResults()); |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
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)) }, |
Contributor
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
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);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.