Skip to content

Commit 0475af7

Browse files
committed
more fp8
1 parent d0c8e24 commit 0475af7

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

candle-core/benches/benchmarks/affine.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fn criterion_benchmark(c: &mut Criterion) {
3737
run_affine_benchmark(c, &device, DType::F32, "affine_f32");
3838
run_affine_benchmark(c, &device, DType::F16, "affine_f16");
3939
run_affine_benchmark(c, &device, DType::BF16, "affine_bf16");
40+
run_affine_benchmark(c, &device, DType::F8E4M3, "affine_fp8");
4041
}
4142
}
4243

candle-core/benches/benchmarks/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub(crate) mod reduce;
88
pub(crate) mod unary;
99
pub(crate) mod where_cond;
1010

11-
use candle_core::{Device, Result};
11+
use candle_core::{backend::BackendDevice, Device, Result};
1212

1313
pub(crate) trait BenchDevice {
1414
fn sync(&self) -> Result<()>;

candle-kernels/src/affine.cu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ extern "C" __global__ void FN_NAME( \
3030

3131
#if __CUDA_ARCH__ >= 800
3232
AFFINE_OP(__nv_bfloat16, affine_bf16, x * mul + add)
33+
#endif
3334

35+
#if __CUDA_ARCH__ >= 890
3436
#define F8E4M3_TO_FLOAT(x) __half2float(__nv_cvt_fp8_to_halfraw(x.__x, __NV_E4M3))
3537

3638
AFFINE_OP(__nv_fp8_e4m3, affine_f8_e4m3, __nv_fp8_e4m3(F8E4M3_TO_FLOAT(x) * F8E4M3_TO_FLOAT(mul) + F8E4M3_TO_FLOAT(add)))

0 commit comments

Comments
 (0)