-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
python3Packages.tinygrad: init at 0.8.0 #287914
Conversation
ff68602
to
165bf48
Compare
Just noting here for future reference, but |
|
||
pythonImportsCheck = [ "gpuctypes" ]; | ||
|
||
# All tests require a GPU to work. This is not possible in the sandbox. |
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.
This isn't quite true, since a lot of the tests can be run with a different backend, like "CLANG", "LLVM", or "CPU"
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.
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.
Oh my bad read package name wrong, thought this was in tinygrad
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.
But the compilation tests should still be possible to run since they should not need a GPU to be present: https://github.com/tinygrad/gpuctypes/blob/c4c4394239dce4d4ecfe7016ca268c49cb2d02a4/test/test_hip.py#L19
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.
We tried to run the OpenCL ones but got runtime error... Do you think that test_hip.py
has better chances ?
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.
The opencl ones do require a device but hip and cuda, not the hipdevice or cudadevice tests should be runnable
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.
This makes some remote sense maybe. Doesn't OpenCL use the runtime driver to compile the device code, like opengl does?
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.
After blackmagic-patching, @SomeoneSerge and I were able to run the compilation tests for HIP and CUDA !
Result of 6 packages built:
|
165bf48
to
820a826
Compare
Result of 6 packages built:
|
substituteInPlace gpuctypes/hip.py \ | ||
--replace "/opt/rocm/lib/libamdhip64.so" "${rocmPackages.clr}/lib/libamdhip64.so" \ | ||
--replace "/opt/rocm/lib/libhiprtc.so" "${rocmPackages.clr}/lib/libhiprtc.so" \ | ||
--replace "hipGetDevicePropertiesR0600" "hipGetDeviceProperties" |
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.
One more thought: this is likely going to break with rocmPackages_6
, and this also means this patch doesn't account for the possibility of .override { rocmPackages = somethingElse; }
. The failure isn't going to be silent (we know the tests fail unless the symbol is found) so that's enough to get started
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.
@NixOS/rocm-maintainers could you actually please test this? We've no idea if this works. We could mark this as broken = rocmSupport
but then we'll most likely never find out if it works because nobody would care to override and test 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.
I've ran into issues with just patching it like this, the patch is slightly more complicated since the hipDeviceProp_t
struct changes between rocm 5 and rocm 6, which is why they have the R0600 suffix. I've patched it by just adding the autogenned struct from rocm 5 and replacing hipDeviceProp_tR0600
with hipDeviceProp_t
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.
@wozeparrot so does something need to be changed? By the way, if you've got access to amd hardware, could you maybe run the tests?
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.
Currently I'm running this patch: https://github.com/wozeparrot/tinygrad-nix/blob/main/hip.patch, but this is against tinygrad master where gpuctypes is no longer used but the patch should apply to gpuctypes as well.
By the way, if you've got access to amd hardware, could you maybe run the tests?
Yea I can give running the tests a try.
0037c48
to
df30f9e
Compare
pytestFlagsArray = lib.optionals (!testCudaRuntime) [ | ||
"-k" "'not TestCUDADevice'" | ||
] ++ lib.optionals (!testRocmRuntime) [ | ||
"-k" "'not TestHIPDevice'" | ||
] ++ lib.optionals (testCudaRuntime || testOpenclRuntime || testRocmRuntime) [ | ||
"-v" | ||
]; |
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.
Now we can disable the tests conditionally on whether a GPU is available in the sandbox:
https://gist.github.com/GaetanLepage/5cbaefd048c13626eb2eacf567809e49
Based on: #256230
''; | ||
|
||
disabledTests = [ | ||
# Require internet access |
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.
A note for future: for small, compact, and reusable things like MNIST, maybe would could actually add a FOD. If we ever do, we probably want to expose it somewhere as an attribute so we can use it other derivations. A subject for a separate discussion really
@ofborg build python3Packages.tinygrad |
Result of 2 packages failed to build:
4 packages built:
|
Result of 6 packages built:
|
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.
> Executing pythonRuntimeDepsCheck
> Checking runtime dependencies for tinygrad-0.8.0-py3-none-any.whl
> - pyobjc-framework-metal not installed
> - pyobjc-framework-libdispatch not installed
For full logs, run 'nix log /nix/store/yzz6r1irlh2l783y8wq6jdbpri3j387q-python3.11-tinygrad-0.8.0.drv'.
aarch64-darwin https://logs.ofborg.org/?key=nixos/nixpkgs.287914&attempt_id=1be6809e-6aa0-4d50-acce-e1e3616654a8
Result of 6 packages built:
|
@ofborg eval |
Co-authored-by: SomeoneSerge <[email protected]>
Co-authored-by: matthewcroughan <[email protected]>
To sum up:
|
Description of changes
Add tinygrad, a simple and powerful neural network framework.
cc @SomeoneSerge @MatthewCroughan @wozeparrot
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.