-
Notifications
You must be signed in to change notification settings - Fork 110
Experimental build.zig #262
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
base: master
Are you sure you want to change the base?
Conversation
fn testFn() void { | ||
std.debug.assert(remainingStackSize() > 2048); | ||
// Check if the stack was already overflowed | ||
const current = xframe(); |
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.
@Corendos not sure what this test is doing but it's not compiling anymore.
std.testing.refAllDecls(gguf); | ||
std.testing.refAllDecls(nemo); | ||
// std.testing.refAllDecls(nemo); | ||
std.testing.refAllDecls(safetensors); |
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 haven't ported the yaml deps to build.zig, but also not sure it's worth it. The nemo/yaml code doesn't compile anyway.
zml/BUILD.bazel
Outdated
visibility = ["//visibility:public"], | ||
deps = [ | ||
":posix", | ||
":sentencepiece_model_proto", |
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.
wasn't used
zml/BUILD.bazel
Outdated
"//stdx", | ||
"//zml/tokenizer", | ||
"//zml/tools", | ||
"@rules_zig//zig/lib:libc", |
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.
wasn't used
9c591b3
to
d09a6a5
Compare
fixup! add "zml_sandbox"
57364d0
to
7be70e8
Compare
This is the non-controversial part of #262 It contains: * the new `zig_srcs` helper, * bug fix related to sources in rules_zig, * cleanups of zml/BUILD.bazel * test fixes in async/coro.zig (those tests weren't run in CI but now are) * disabled nemo and yaml models loader (don't compile anymore since 0.14.0 bump)
# Conflicts: # bazel/zig_srcs.bzl
relevant PRs: libxev: mitchellh/libxev@7f80318 zig-protobuf: https://github.com/zml/zig-protobuf/pull/1/files Signed-off-by: Guillaume Wenzek <[email protected]>
allow to pass pregenerated tarball to avoid calling `bazel //zml:sources` This help when upgrading Zig versions and ZML code is not fully ported yet, but we want to use build.zig
!!! This build.zig is experimental !!!
#67
It shows how to bridge Bazel and build.zig.
It requires the user to have
bazel
andtar
installed on their machine.Bazel is used to:
build.zig finishes the work by:
zig build test --summary all
will run a lot of testszig build test-zml
will stick to ZML test suitezig build -Druntimes:cpu=true -Druntimes:cuda=false test
will enable/disable runtimesCaveats:
ziglang/zig@8eb5813
this works around zig fetch: Erroneous
FileBusy
error if package tarball's paths are prefixed with./
ziglang/zig#23152Potential follow ups:
The main missing is that Bazel takes care of sandboxing
ZML executables and the PJRT runtimes and all the dependencies.
This part has not been added to build.zig beyond mininal rPath for the the libpjrt_xxx.so,
but for cuda you have more depedencies that would need to be sandboxed.
The module graph of the various protobuffers is alson a bit big,
and if it changes it will be tedious to update. Ideally bazel should generate this graph of deps for us.