Skip to content

Commit

Permalink
fixed cuda ntt headers
Browse files Browse the repository at this point in the history
  • Loading branch information
yshekel committed Jun 13, 2024
1 parent 4be5d6a commit a7e288e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 88 deletions.
22 changes: 12 additions & 10 deletions icicle_v3/backend/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ add_library(icicle_cpu_device SHARED src/cpu_device_api.cpp)
target_link_libraries(icicle_cpu_device PUBLIC icicle_device)

# field API library
add_library(icicle_cpu_field SHARED
src/field/cpu_vec_ops.cpp
src/field/cpu_matrix_ops.cpp
)
if (NTT)
target_sources(icicle_cpu_field PUBLIC src/field/cpu_ntt.cpp)
endif()
target_include_directories(icicle_cpu_field PUBLIC include)
target_link_libraries(icicle_cpu_field PUBLIC icicle_device icicle_field)
set_target_properties(icicle_cpu_field PROPERTIES OUTPUT_NAME "icicle_cpu_field_${FIELD}")
if (FIELD)
add_library(icicle_cpu_field SHARED
src/field/cpu_vec_ops.cpp
src/field/cpu_matrix_ops.cpp
)
if (NTT)
target_sources(icicle_cpu_field PUBLIC src/field/cpu_ntt.cpp)
endif()
target_include_directories(icicle_cpu_field PUBLIC include)
target_link_libraries(icicle_cpu_field PUBLIC icicle_device icicle_field)
set_target_properties(icicle_cpu_field PROPERTIES OUTPUT_NAME "icicle_cpu_field_${FIELD}")
endif() # FIELD

# curve API library
if (CURVE)
Expand Down
32 changes: 17 additions & 15 deletions icicle_v3/backend/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@ target_include_directories(icicle_cuda_device PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLU
target_link_libraries(icicle_cuda_device PRIVATE ${CUDA_LIBRARIES}) # Link to CUDA

# field API library
add_library(icicle_cuda_field SHARED
src/field/cuda_vec_ops.cu
src/field/cuda_mont.cu
)
if(NTT)
target_sources(icicle_cuda_field PUBLIC
src/ntt/cuda_ntt.cu
src/ntt/mixed_radix_ntt.cu
)
endif()
target_include_directories(icicle_cuda_field PRIVATE include)
target_link_libraries(icicle_cuda_field PUBLIC icicle_device icicle_field)
set_target_properties(icicle_cuda_field PROPERTIES OUTPUT_NAME "icicle_cuda_field_${FIELD}")
target_include_directories(icicle_cuda_field PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
target_link_libraries(icicle_cuda_field PRIVATE ${CUDA_LIBRARIES}) # Link to CUDA
if (FIELD)
add_library(icicle_cuda_field SHARED
src/field/cuda_vec_ops.cu
src/field/cuda_mont.cu
)
if(NTT)
target_sources(icicle_cuda_field PUBLIC
src/ntt/cuda_ntt.cu
src/ntt/mixed_radix_ntt.cu
)
endif()
target_include_directories(icicle_cuda_field PRIVATE include)
target_link_libraries(icicle_cuda_field PUBLIC icicle_device icicle_field)
set_target_properties(icicle_cuda_field PROPERTIES OUTPUT_NAME "icicle_cuda_field_${FIELD}")
target_include_directories(icicle_cuda_field PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
target_link_libraries(icicle_cuda_field PRIVATE ${CUDA_LIBRARIES}) # Link to CUDA
endif() # FIELD

# curve API library
if (CURVE)
Expand Down
51 changes: 0 additions & 51 deletions icicle_v3/backend/cuda/include/ntt/cuda_ntt.h

This file was deleted.

9 changes: 9 additions & 0 deletions icicle_v3/backend/cuda/include/ntt/cuda_ntt_config.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <stdint.h>

enum class NttAlgorithm : int { Auto, Radix2, MixedRadix };

// backend specific flags
#define CUDA_NTT_FAST_TWIDDLES_MODE "fast_twiddles"
#define CUDA_NTT_ALGORITHM "ntt_algorithm"
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
#pragma once

#include <stdint.h>
#include "icicle/ntt.h" // for enum Ordering

enum class NttAlgorithm : int { Auto, Radix2, MixedRadix };

// backend specific flags
#define CUDA_NTT_FAST_TWIDDLES_MODE "fast_twiddles"
#define CUDA_NTT_ALGORITHM "ntt_algorithm"

namespace mxntt {

Expand Down Expand Up @@ -48,4 +38,4 @@ namespace mxntt {
int coset_gen_index,
cudaStream_t cuda_stream);

} // namespace mxntt
} // namespace mxntt
3 changes: 2 additions & 1 deletion icicle_v3/backend/cuda/src/ntt/ntt.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include "utils/utils_kernels.h"
#include "gpu-utils/device_context.h"
#include "gpu-utils/error_handler.h"
#include "ntt/cuda_ntt.cuh"
#include "mixed_radix_ntt.cuh"
#include "ntt/cuda_ntt_config.cuh"
#include "icicle/utils/utils.h"

#include "icicle/fields/field_config.h"
Expand Down

0 comments on commit a7e288e

Please sign in to comment.