-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-- 07db838 by Mihai.Olinovici <[email protected]>: Add RVV f32-f16-vcvt kernels and configs. FUTURE_COPYBARA_INTEGRATE_REVIEW=#7128 from imaginationtech:img_patch30_f32_f16_vcvt bd821ed PiperOrigin-RevId: 678634358
- Loading branch information
1 parent
2286715
commit cc5d8eb
Showing
9 changed files
with
221 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Auto-generated file. Do not edit! | ||
// Template: src/f32-f16-vcvt/rvvfp16arith.c.in | ||
// Generator: tools/xngen | ||
// | ||
// Copyright 2024 Imagination Technologies, Inc. | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include <assert.h> | ||
|
||
#include <riscv_vector.h> | ||
|
||
#include "xnnpack/vcvt.h" | ||
|
||
|
||
void xnn_f32_f16_vcvt_ukernel__rvvfp16arith_u1v( | ||
size_t batch, | ||
const float* input, | ||
void* output, | ||
const void* params) | ||
{ | ||
assert(batch != 0); | ||
assert(batch % sizeof(float) == 0); | ||
assert(input != NULL); | ||
assert(output != NULL); | ||
|
||
batch >>= XNN_LOG2_SIZEOF_FLOAT; | ||
|
||
_Float16* o = (_Float16*) output; | ||
for (; batch > 0;) { | ||
const int32_t n = __riscv_vsetvl_e32m1(batch); batch -= n; | ||
|
||
vfloat32m1_t x_f32v = __riscv_vle32_v_f32m1(input, n); input += n; | ||
|
||
vfloat16mf2_t y_f16v = __riscv_vfncvt_f_f_w_f16mf2(x_f32v, n); | ||
|
||
__riscv_vse16_v_f16mf2(o, y_f16v, n); o += n; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Auto-generated file. Do not edit! | ||
// Template: src/f32-f16-vcvt/rvvfp16arith.c.in | ||
// Generator: tools/xngen | ||
// | ||
// Copyright 2024 Imagination Technologies, Inc. | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include <assert.h> | ||
|
||
#include <riscv_vector.h> | ||
|
||
#include "xnnpack/vcvt.h" | ||
|
||
|
||
void xnn_f32_f16_vcvt_ukernel__rvvfp16arith_u2v( | ||
size_t batch, | ||
const float* input, | ||
void* output, | ||
const void* params) | ||
{ | ||
assert(batch != 0); | ||
assert(batch % sizeof(float) == 0); | ||
assert(input != NULL); | ||
assert(output != NULL); | ||
|
||
batch >>= XNN_LOG2_SIZEOF_FLOAT; | ||
|
||
_Float16* o = (_Float16*) output; | ||
for (; batch > 0;) { | ||
const int32_t n = __riscv_vsetvl_e32m2(batch); batch -= n; | ||
|
||
vfloat32m2_t x_f32v = __riscv_vle32_v_f32m2(input, n); input += n; | ||
|
||
vfloat16m1_t y_f16v = __riscv_vfncvt_f_f_w_f16m1(x_f32v, n); | ||
|
||
__riscv_vse16_v_f16m1(o, y_f16v, n); o += n; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Auto-generated file. Do not edit! | ||
// Template: src/f32-f16-vcvt/rvvfp16arith.c.in | ||
// Generator: tools/xngen | ||
// | ||
// Copyright 2024 Imagination Technologies, Inc. | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include <assert.h> | ||
|
||
#include <riscv_vector.h> | ||
|
||
#include "xnnpack/vcvt.h" | ||
|
||
|
||
void xnn_f32_f16_vcvt_ukernel__rvvfp16arith_u4v( | ||
size_t batch, | ||
const float* input, | ||
void* output, | ||
const void* params) | ||
{ | ||
assert(batch != 0); | ||
assert(batch % sizeof(float) == 0); | ||
assert(input != NULL); | ||
assert(output != NULL); | ||
|
||
batch >>= XNN_LOG2_SIZEOF_FLOAT; | ||
|
||
_Float16* o = (_Float16*) output; | ||
for (; batch > 0;) { | ||
const int32_t n = __riscv_vsetvl_e32m4(batch); batch -= n; | ||
|
||
vfloat32m4_t x_f32v = __riscv_vle32_v_f32m4(input, n); input += n; | ||
|
||
vfloat16m2_t y_f16v = __riscv_vfncvt_f_f_w_f16m2(x_f32v, n); | ||
|
||
__riscv_vse16_v_f16m2(o, y_f16v, n); o += n; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Auto-generated file. Do not edit! | ||
// Template: src/f32-f16-vcvt/rvvfp16arith.c.in | ||
// Generator: tools/xngen | ||
// | ||
// Copyright 2024 Imagination Technologies, Inc. | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include <assert.h> | ||
|
||
#include <riscv_vector.h> | ||
|
||
#include "xnnpack/vcvt.h" | ||
|
||
|
||
void xnn_f32_f16_vcvt_ukernel__rvvfp16arith_u8v( | ||
size_t batch, | ||
const float* input, | ||
void* output, | ||
const void* params) | ||
{ | ||
assert(batch != 0); | ||
assert(batch % sizeof(float) == 0); | ||
assert(input != NULL); | ||
assert(output != NULL); | ||
|
||
batch >>= XNN_LOG2_SIZEOF_FLOAT; | ||
|
||
_Float16* o = (_Float16*) output; | ||
for (; batch > 0;) { | ||
const int32_t n = __riscv_vsetvl_e32m8(batch); batch -= n; | ||
|
||
vfloat32m8_t x_f32v = __riscv_vle32_v_f32m8(input, n); input += n; | ||
|
||
vfloat16m4_t y_f16v = __riscv_vfncvt_f_f_w_f16m4(x_f32v, n); | ||
|
||
__riscv_vse16_v_f16m4(o, y_f16v, n); o += n; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2024 Imagination Technologies, Inc. | ||
// | ||
// This source code is licensed under the BSD-style license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
$assert LMUL in [1, 2, 4, 8] | ||
$LMUL_16 = {1: "f2", 2: "1", 4: "2", 8: "4"}[LMUL] | ||
#include <assert.h> | ||
|
||
#include <riscv_vector.h> | ||
|
||
#include "xnnpack/vcvt.h" | ||
|
||
|
||
void xnn_f32_f16_vcvt_ukernel__rvvfp16arith_u${LMUL}v( | ||
size_t batch, | ||
const float* input, | ||
void* output, | ||
const void* params) | ||
{ | ||
assert(batch != 0); | ||
assert(batch % sizeof(float) == 0); | ||
assert(input != NULL); | ||
assert(output != NULL); | ||
|
||
batch >>= XNN_LOG2_SIZEOF_FLOAT; | ||
|
||
_Float16* o = (_Float16*) output; | ||
for (; batch > 0;) { | ||
const int32_t n = __riscv_vsetvl_e32m${LMUL}(batch); batch -= n; | ||
|
||
vfloat32m${LMUL}_t x_f32v = __riscv_vle32_v_f32m${LMUL}(input, n); input += n; | ||
|
||
vfloat16m${LMUL_16}_t y_f16v = __riscv_vfncvt_f_f_w_f16m${LMUL_16}(x_f32v, n); | ||
|
||
__riscv_vse16_v_f16m${LMUL_16}(o, y_f16v, n); o += n; | ||
} | ||
} |