Skip to content

feat: added experimental support for linux #74

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

Merged
merged 8 commits into from
Feb 13, 2025
Merged

Conversation

cocoa-xu
Copy link
Member

No description provided.

Signed-off-by: Cocoa <i@uwucocoa.moe>
@cocoa-xu cocoa-xu force-pushed the cx-experimental-linux-cpu branch from dda069b to a6e93cc Compare February 13, 2025 12:54
Signed-off-by: Cocoa <i@uwucocoa.moe>
Signed-off-by: Cocoa <i@uwucocoa.moe>
Signed-off-by: Cocoa <i@uwucocoa.moe>
Signed-off-by: Cocoa <i@uwucocoa.moe>
@cocoa-xu
Copy link
Member Author

Looks good in general except that on x86_64 linux it casts Nx.Constants.infinity() to 0 for :u8

1) test Nx.as_type non-finite to integer conversions (EMLX.NxTest)
     test/emlx/nx_test.exs:639
     Assertion with == failed
     code:  assert actual == expected
     left:  #Nx.Tensor<
              u8[3]
              [0, 0, 0]
            >
     right: #Nx.Tensor<
              u8[3]
              [255, 0, 0]
            >
     stacktrace:
       (elixir 1.[15](https://github.com/elixir-nx/emlx/actions/runs/13310468146/job/37171487570#step:6:16).4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
       test/emlx/nx_test.exs:643: (test)

@cocoa-xu
Copy link
Member Author

After some debugging, this appears to be an issue in EMLX.astype for x86_64 linux when using CPU backend.

[lib/emlx/backend.ex:1224: EMLX.Backend.as_type/2]
EMLX.to_blob(t) #=> <<0, 0, 128, 127>>

[lib/emlx/backend.ex:1225: EMLX.Backend.as_type/2]
to_nx(EMLX.astype(t, to_mlx_type(type)), out) #=> #Nx.Tensor<
  u8
  0
>

[lib/emlx/backend.ex:1226: EMLX.Backend.as_type/2]
EMLX.to_blob(EMLX.astype(t, to_mlx_type(type))) #=> <<0>>

Going to skip that unit test.

@cocoa-xu cocoa-xu merged commit 6afc1a7 into main Feb 13, 2025
5 checks passed
@cocoa-xu cocoa-xu deleted the cx-experimental-linux-cpu branch February 13, 2025 17:57
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.

1 participant