Skip to content

Commit

Permalink
[Feature](mluOpExecFFT): merge ict-fft
Browse files Browse the repository at this point in the history
  • Loading branch information
squidruge committed Jun 1, 2024
1 parent aff350d commit 7a28235
Show file tree
Hide file tree
Showing 18 changed files with 9,835 additions and 756 deletions.
82 changes: 82 additions & 0 deletions fft_c2c_2d_gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import os
# a=os.system("ping 192.168.1.101")

rela_path = './test/mlu_op_gtest/pb_gtest/src/zoo/fft/test_case/'
# rela_path = './test_gen_pb/'
os.system("rm -f " + rela_path + "*")


batch = 1
# n = [2048, 14000]
# n_lst = [[2048, 13000]]

n_lst = [[2048, 6000], [2048, 7000], [2048, 8000], [2048, 9000], [2048, 10000],[2048, 11000],[2048, 12000],[2048, 13000],[2048, 14000]]

for n in n_lst:
file_path = rela_path + 'fft_' + str(n[0]) + '_' + str(n[1]) + '.prototxt'
with open(file_path, 'w') as f:
prototxt_content = "op_name: \"fft\"\n" + \
"input {\n" + \
" id: \"input1\"\n" + \
" shape {\n" + \
" dims: {0}\n".format(batch) + \
" dims: {0}\n".format(n[0]) + \
" dims: {0}\n".format(n[1]) + \
" dim_stride: {0}\n".format(n[0] * n[1]) + \
" dim_stride: {0}\n".format(n[1]) + \
" dim_stride: 1\n" + \
" }\n" + \
" layout: LAYOUT_ARRAY\n" + \
" dtype: DTYPE_COMPLEX_FLOAT\n" + \
" random_data {\n" + \
" seed: 23\n" + \
" distribution: UNIFORM\n" + \
" lower_bound_double: -10\n" + \
" upper_bound_double: 10\n" + \
" }\n" + \
" onchip_dtype: DTYPE_FLOAT\n" + \
"}\n" + \
"output {\n" + \
" id: \"output1\"\n" + \
" shape {\n" + \
" dims: {0}\n".format(batch) + \
" dims: {0}\n".format(n[0]) + \
" dims: {0}\n".format(n[1]) + \
" dim_stride: {0}\n".format(n[0] * n[1]) + \
" dim_stride: {0}\n".format(n[1]) + \
" dim_stride: 1\n" + \
" }\n" + \
" layout: LAYOUT_ARRAY\n" + \
" dtype: DTYPE_COMPLEX_FLOAT\n" + \
" thresholds {\n" + \
" evaluation_threshold: 1e-05\n" + \
" evaluation_threshold: 1e-05\n" + \
" evaluation_threshold_imag: 1e-05\n" + \
" evaluation_threshold_imag: 1e-05\n" + \
" }\n" + \
"}\n" + \
"evaluation_criterion: DIFF1\n" + \
"evaluation_criterion: DIFF2\n" + \
"supported_mlu_platform: MLU370\n" + \
"handle_param {\n" + \
" round_mode: ROUND_OFF_ZERO\n" + \
"}\n" + \
"fft_param {\n" + \
" rank: 2\n" + \
" n: {0}\n".format(n[0]) + \
" n: {0}\n".format(n[1]) + \
" direction: 0\n" + \
" scale_factor: 1\n" + \
"}\n" + \
"test_param: {\n" + \
" error_func: DIFF1\n" + \
" error_func: DIFF2\n" + \
" error_threshold: 1e-05\n" + \
" error_threshold: 1e-05\n" + \
" baseline_device: CPU\n" + \
"}"
f.write(prototxt_content)




14 changes: 14 additions & 0 deletions kernels/fft/c2c_fft/c2c_fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,22 @@ mluOpStatus_t makeFFT1dPolicy(mluOpHandle_t handle, mluOpFFTPlan_t fft_plan);
mluOpStatus_t setFFT1dReserveArea(mluOpHandle_t handle, mluOpFFTPlan_t fft_plan,
const std::string api);

mluOpStatus_t setFFT1dReserveArea_v2(mluOpHandle_t handle,
mluOpFFTPlan_t fft_plan,
const std::string api);

mluOpStatus_t setFFT2dReserveArea(mluOpHandle_t handle, mluOpFFTPlan_t fft_plan,
const std::string api);

mluOpStatus_t execFFT1d(mluOpHandle_t handle, const mluOpFFTPlan_t fft_plan,
const void *input, const float scale_factor,
void *workspace, void *output, int direction);

mluOpStatus_t execFFT2d(mluOpHandle_t handle, const mluOpFFTPlan_t fft_plan,
const void *input, const float scale_factor,
void *workspace, void *output, int direction);
// mluOpStatus_t execFFT1d(mluOpHandle_t handle, const mluOpFFTPlan_t fft_plan,
// const void *input, const float scale_factor,
// void *workspace, void *output, int direction);

#endif // KERNELS_FFT_C2C_FFT_C2C_FFT_H_
Loading

0 comments on commit 7a28235

Please sign in to comment.