Skip to content

Conversation

@gwenzek
Copy link
Contributor

@gwenzek gwenzek commented Mar 18, 2025

No description provided.

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
Base automatically changed from gw/no_using_floats to master March 18, 2025 15:19
gwenzek added 2 commits April 10, 2025 10:47
# 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 gwenzek requested a review from Corendos June 6, 2025 14:15
@gwenzek gwenzek force-pushed the gw/no_using_mlir branch from 648760e to 0c3d245 Compare June 10, 2025 07:41
@gwenzek gwenzek force-pushed the gw/no_using_mlir branch from 33cce1f to f678ba8 Compare June 10, 2025 07:55
}
}).cb, &local_context, &res);
assert(local_context.index == op.numResults());
std.debug.assert(local_context.index == op.numResults());
Copy link
Contributor

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

Copy link
Contributor Author

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)) },
Copy link
Contributor

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

Copy link
Contributor Author

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);
}

@gwenzek gwenzek merged commit e15d3a9 into master Jun 10, 2025
1 check passed
@gwenzek gwenzek deleted the gw/no_using_mlir branch June 10, 2025 13:51
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

Successfully merging this pull request may close these issues.

3 participants