You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Binary operations (for eg: add) where one of the arrays is f16 does not compile, raising the following compiler error:
error[E0277]: the trait bound `f16: ImplicitPromote<f32>` is not satisfied
This is because the ImplicitPromote<*> traits have not been implemented for f16. There also doesn't seem to be a ImplicitPromote<f16> trait. Implementing these traits for f16 should fix the issue.
error[E0271]: type mismatch resolving `<Array<f32> as Convertable>::OutType == f16`
--> src/main.rs:13:12
|
13 | print(&add(&hvals, &vals, false));
| ^^^ expected `f32`, found struct `f16`
error[E0277]: the trait bound `f32: ImplicitPromote<f16>` is not satisfied
--> src/main.rs:13:24
|
13 | print(&add(&hvals, &vals, false));
| --- ^^^^^ the trait `ImplicitPromote<f16>` is not implemented for `f32`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<f32 as ImplicitPromote<bool>>
<f32 as ImplicitPromote<f64>>
<f32 as ImplicitPromote<i16>>
<f32 as ImplicitPromote<i32>>
and 95 others
note: required by a bound in `arrayfire::add`
--> /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.8.0/src/core/arith.rs:474:1
|
474 | overloaded_binary_func!("Addition of two Arrays", add, add_helper, af_add);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `arrayfire::add`
= note: this error originates in the macro `overloaded_binary_func` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0271]: type mismatch resolving `<Array<f32> as Convertable>::OutType == f16`
--> src/main.rs:13:12
|
13 | print(&add(&hvals, &vals, false));
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `f32`, found struct `f16`
error[E0277]: the trait bound `f32: ImplicitPromote<f16>` is not satisfied
--> src/main.rs:14:16
|
14 | print(&add(&vals, &hvals, false));
| --- ^^^^^ the trait `ImplicitPromote<f16>` is not implemented for `f32`
| |
| required by a bound introduced by this call
|
= help: the following implementations were found:
<f32 as ImplicitPromote<bool>>
<f32 as ImplicitPromote<f64>>
<f32 as ImplicitPromote<i16>>
<f32 as ImplicitPromote<i32>>
and 95 others
note: required by a bound in `arrayfire::add`
--> /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.8.0/src/core/arith.rs:474:1
|
474 | overloaded_binary_func!("Addition of two Arrays", add, add_helper, af_add);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `arrayfire::add`
= note: this error originates in the macro `overloaded_binary_func` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `f16: ImplicitPromote<f32>` is not satisfied
--> src/main.rs:14:23
|
14 | print(&add(&vals, &hvals, false));
| --- ^^^^^^ the trait `ImplicitPromote<f32>` is not implemented for `f16`
| |
| required by a bound introduced by this call
|
note: required by a bound in `arrayfire::add`
--> /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.8.0/src/core/arith.rs:474:1
|
474 | overloaded_binary_func!("Addition of two Arrays", add, add_helper, af_add);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `arrayfire::add`
= note: this error originates in the macro `overloaded_binary_func` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `f16: ImplicitPromote<f32>` is not satisfied
--> src/main.rs:13:12
|
13 | print(&add(&hvals, &vals, false));
| ^^^ the trait `ImplicitPromote<f32>` is not implemented for `f16`
error[E0277]: the trait bound `f32: ImplicitPromote<f16>` is not satisfied
--> src/main.rs:14:12
|
14 | print(&add(&vals, &hvals, false));
| ^^^ the trait `ImplicitPromote<f16>` is not implemented for `f32`
|
= help: the following implementations were found:
<f32 as ImplicitPromote<bool>>
<f32 as ImplicitPromote<f64>>
<f32 as ImplicitPromote<i16>>
<f32 as ImplicitPromote<i32>>
and 95 others
Some errors have detailed explanations: E0271, E0277.
For more information about an error, try `rustc --explain E0271`.
error: could not compile `afbug` due to 7 previous errors
System Information
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 36 (Thirty Six)
Release: 36
Codename: ThirtySix
nvidia-smi not found
rocm-smi not found.
clinfo not found.
Checklist
Using the latest available ArrayFire release
GPU drivers are up to date
The text was updated successfully, but these errors were encountered:
- Support binary ops
- Move helper functions to a helper module
- Switch arrayfire dep to a fork (See arrayfire/arrayfire-rust#320)
A major thing to note is that the binary ops are half broken.
This is because there isn't a broadcast implementation yet so,
binary ops with tensors of different shapes will return invalid
results.
Description
Binary operations (for eg: add) where one of the arrays is f16 does not compile, raising the following compiler error:
This is because the
ImplicitPromote<*>
traits have not been implemented for f16. There also doesn't seem to be aImplicitPromote<f16>
trait. Implementing these traits for f16 should fix the issue.Reproducible Code and/or Steps
The following code:
Gives these errors:
System Information
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 36 (Thirty Six)
Release: 36
Codename: ThirtySix
nvidia-smi not found
rocm-smi not found.
clinfo not found.
Checklist
The text was updated successfully, but these errors were encountered: