Skip to content
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

error casting between dtypes.double and dtypes.half on CLANG #4084

Open
chenyuxyz opened this issue Apr 5, 2024 · 1 comment
Open

error casting between dtypes.double and dtypes.half on CLANG #4084

chenyuxyz opened this issue Apr 5, 2024 · 1 comment

Comments

@chenyuxyz
Copy link
Collaborator

chenyuxyz commented Apr 5, 2024

probably target dependent, __fp16 is for ARM only? but CI passes too

example, with CLANG=1

a = Tensor([1, 2, 3], dtype=dtypes.double)
print(a.numpy())
print(a.cast(dtypes.half).numpy())

source

#include <stdbool.h>
#include <tgmath.h>
#define max(x,y) ((x>y)?x:y)
#define half __fp16
void E_3(half* restrict data0, const double* restrict data1) {
  for (int ridx0 = 0; ridx0 < 3; ridx0++) {
    double val0 = data1[ridx0];
    data0[ridx0] = (half)(val0);
  }
}

on mac m1 max

[1. 2. 3.]
[1. 2. 3.]

on tinybox, ubuntu 22.04

[1. 2. 3.]
[0.00e+00 0.00e+00 3.05e-05]
@chenyuxyz chenyuxyz changed the title error casting between dtypes.double and dtypes.half error casting between dtypes.double and dtypes.half on CLANG Apr 5, 2024
@mooihi
Copy link

mooihi commented May 19, 2024

The new runners do not have gcc-13 installed, this is inline with Ubuntu 22.04 default gcc package versions (up to gcc-12). The old runner had gcc-13 installed and clang seemed to be able to use those library files and compile properly.

EDIT: Having libgcc-s1=13.1.0-8ubuntu1~22.04 makes the dynamic linking works properly but libgcc-s1=12.3.0-1ubuntu1~22.04 does not.

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

No branches or pull requests

2 participants