Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions projects/hipfft/clients/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ if( hipfft_callback IN_LIST sample_list )
if( BUILD_WITH_LIB STREQUAL "CUDA" )
target_compile_options( hipfft_callback PRIVATE -dc )
else()
target_compile_options( hipfft_callback PRIVATE -fgpu-rdc )
target_link_options( hipfft_callback PRIVATE -fgpu-rdc )
# -fgpu-rdc causes failure at link stage on Windows
if (NOT WIN32)
target_compile_options( hipfft_callback PRIVATE -fgpu-rdc )
target_link_options( hipfft_callback PRIVATE -fgpu-rdc )
endif()
endif()
endif()
8 changes: 8 additions & 0 deletions projects/hipfft/clients/samples/hipfft_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// THE SOFTWARE.

#include <iostream>
#ifndef WIN32
#include <vector>

#include <hip/hip_runtime.h>
Expand Down Expand Up @@ -48,9 +49,15 @@ __device__ hipfftDoubleComplex load_callback(hipfftDoubleComplex* input,
}

__device__ auto load_callback_dev = load_callback;
#endif

int main()
{
#ifdef WIN32
std::cout << "This sample is temporarily disabled on Windows" << std::endl;
return EXIT_SUCCESS;
#else

std::cout << "hipfft 1D double-precision complex-to-complex transform with callback\n";

const int Nx = 8;
Expand Down Expand Up @@ -156,4 +163,5 @@ int main()
throw std::runtime_error("hipFree failed");

return 0;
#endif
}
7 changes: 5 additions & 2 deletions projects/hipfft/clients/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,11 @@ endif()
if( BUILD_WITH_LIB STREQUAL "CUDA" )
target_compile_options( hipfft-test PRIVATE -dc )
else()
target_compile_options( hipfft-test PRIVATE -fgpu-rdc )
target_link_options( hipfft-test PRIVATE -fgpu-rdc )
# -fgpu-rdc causes failure at link stage on Windows
if (NOT WIN32)
target_compile_options( hipfft-test PRIVATE -fgpu-rdc )
target_link_options( hipfft-test PRIVATE -fgpu-rdc )
endif()
endif()

if(FFTW_MULTITHREAD)
Expand Down
37 changes: 21 additions & 16 deletions projects/hipfft/clients/tests/accuracy_test_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,27 @@ const static std::vector<std::vector<size_t>> ooffset_range = {{0, 0}, {1, 1}};
auto transform_types = {fft_transform_type_complex_forward, fft_transform_type_real_forward};

#ifdef __HIP__
INSTANTIATE_TEST_SUITE_P(callback,
accuracy_test,
::testing::ValuesIn(param_generator_base(test_prob,
transform_types,
callback_sizes,
precision_range_sp_dp,
batch_range,
generate_types,
stride_range,
stride_range,
ioffset_range_zero,
ooffset_range_zero,
place_range,
false,
true)),
accuracy_test::TestName);
INSTANTIATE_TEST_SUITE_P(
#ifdef WIN32
DISABLED_callback_no_offset,
#else
callback,
#endif
accuracy_test,
::testing::ValuesIn(param_generator_base(test_prob,
transform_types,
callback_sizes,
precision_range_sp_dp,
batch_range,
generate_types,
stride_range,
stride_range,
ioffset_range_zero,
ooffset_range_zero,
place_range,
false,
true)),
accuracy_test::TestName);

INSTANTIATE_TEST_SUITE_P(DISABLED_callback,
accuracy_test,
Expand Down
7 changes: 5 additions & 2 deletions projects/rocfft/clients/samples/rocfft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,8 @@ foreach( sample ${sample_list} )
endforeach( )

# callback functions need to be built as relocatable device code
target_compile_options( rocfft_example_callback PRIVATE -fgpu-rdc )
target_link_options( rocfft_example_callback PRIVATE -fgpu-rdc )
# (causes failure at link stage on Windows)
if (NOT WIN32)
target_compile_options( rocfft_example_callback PRIVATE -fgpu-rdc )
target_link_options( rocfft_example_callback PRIVATE -fgpu-rdc )
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
* THE SOFTWARE.
*******************************************************************************/

#include <iostream>
#ifndef WIN32
#include "rocfft/rocfft.h"
#include <hip/hip_complex.h>
#include <hip/hip_runtime.h>
#include <hip/hip_vector_types.h>
#include <iostream>
#include <math.h>
#include <stdexcept>
#include <vector>
Expand All @@ -46,9 +47,14 @@ __device__ double2 load_callback(double2* input, size_t offset, void* cbdata, vo
make_hipDoubleComplex(data->scale, data->scale));
}
__device__ auto load_callback_dev = load_callback;
#endif

int main()
{
#ifdef WIN32
std::cout << "This sample is temporarily disabled on Windows" << std::endl;
return EXIT_SUCCESS;
#else

const size_t N = 8;

Expand Down Expand Up @@ -189,4 +195,5 @@ int main()
throw std::runtime_error("rocfft_cleanup failed.");

return 0;
#endif
}
7 changes: 5 additions & 2 deletions projects/rocfft/clients/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ add_executable( rtc_helper_crash rtc_helper_crash.cpp )
target_compile_options( rocfft-test PRIVATE -Xarch_device -O3 )

# callback functions need to be built as relocatable device code
target_compile_options( rocfft-test PRIVATE -fgpu-rdc )
target_link_options( rocfft-test PRIVATE -fgpu-rdc )
# (causes failure at link stage on Windows)
if (NOT WIN32)
target_compile_options( rocfft-test PRIVATE -fgpu-rdc )
target_link_options( rocfft-test PRIVATE -fgpu-rdc )
endif()

find_package( Boost REQUIRED )
set( Boost_DEBUG ON )
Expand Down
33 changes: 19 additions & 14 deletions projects/rocfft/clients/tests/accuracy_test_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,17 +255,22 @@ INSTANTIATE_TEST_SUITE_P(partial_pass_3D,
false)),
accuracy_test::TestName);

INSTANTIATE_TEST_SUITE_P(partial_pass_3D_callback,
accuracy_test,
::testing::ValuesIn(param_generator(test_prob,
partial_pass_adhoc_3D,
precision_range_sp_dp,
partial_pass_batch_range_3D,
stride_range,
stride_range,
ioffset_range_zero,
ooffset_range_zero,
place_range,
false,
true)),
accuracy_test::TestName);
INSTANTIATE_TEST_SUITE_P(
#ifdef WIN32
DISABLED_partial_pass_3D_callback,
#else
partial_pass_3D_callback,
#endif
accuracy_test,
::testing::ValuesIn(param_generator(test_prob,
partial_pass_adhoc_3D,
precision_range_sp_dp,
partial_pass_batch_range_3D,
stride_range,
stride_range,
ioffset_range_zero,
ooffset_range_zero,
place_range,
false,
true)),
accuracy_test::TestName);
37 changes: 21 additions & 16 deletions projects/rocfft/clients/tests/accuracy_test_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,27 @@ const static std::vector<std::vector<size_t>> ooffset_range = {{0, 0}, {1, 1}};
auto forward_transform_types
= {fft_transform_type_complex_forward, fft_transform_type_real_forward};

INSTANTIATE_TEST_SUITE_P(callback,
accuracy_test,
::testing::ValuesIn(param_generator_base(test_prob,
forward_transform_types,
callback_sizes,
precision_range_sp_dp,
batch_range,
generate_types,
stride_range,
stride_range,
ioffset_range_zero,
ooffset_range_zero,
place_range,
false,
true)),
accuracy_test::TestName);
INSTANTIATE_TEST_SUITE_P(
#ifdef WIN32
DISABLED_callback_no_offset,
#else
callback,
#endif
accuracy_test,
::testing::ValuesIn(param_generator_base(test_prob,
forward_transform_types,
callback_sizes,
precision_range_sp_dp,
batch_range,
generate_types,
stride_range,
stride_range,
ioffset_range_zero,
ooffset_range_zero,
place_range,
false,
true)),
accuracy_test::TestName);

INSTANTIATE_TEST_SUITE_P(DISABLED_callback,
accuracy_test,
Expand Down
4 changes: 4 additions & 0 deletions projects/rocfft/clients/tests/accuracy_test_checkstride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ inline auto param_checkstride()
for(const auto& types :
generate_types(trans_type, {fft_placement_notinplace}, true))
{
#ifdef WIN32
for(bool callback : {false})
#else
for(bool callback : {true, false})
#endif
{
// callbacks don't work for planar
bool is_planar = std::get<2>(types) == fft_array_type_complex_planar
Expand Down
39 changes: 22 additions & 17 deletions projects/rocfft/clients/tests/callback_change_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,28 @@ std::vector<std::vector<size_t>> callback_type_sizes = {{4}, {60}, {122}, {220},
// the input can't be any smaller than what rocFFT thinks it is,
// because the overwrite will fail.
const static std::vector<std::vector<size_t>> stride_range = {{1}};
INSTANTIATE_TEST_SUITE_P(callback,
change_type,
::testing::ValuesIn(param_generator_base(
test_prob,
{fft_transform_type_complex_forward, fft_transform_type_real_forward},
callback_type_sizes,
{fft_precision_single},
{1},
generate_types,
stride_range,
stride_range,
{{0, 0}},
{{0, 0}},
{fft_placement_notinplace},
false,
false)),
accuracy_test::TestName);
INSTANTIATE_TEST_SUITE_P(
#ifdef WIN32
DISABLED_callback,
#else
callback,
#endif
change_type,
::testing::ValuesIn(param_generator_base(test_prob,
{fft_transform_type_complex_forward,
fft_transform_type_real_forward},
callback_type_sizes,
{fft_precision_single},
{1},
generate_types,
stride_range,
stride_range,
{{0, 0}},
{{0, 0}},
{fft_placement_notinplace},
false,
false)),
accuracy_test::TestName);

// run an out-of-place transform that casts input from short to float
TEST_P(change_type, short_to_float)
Expand Down
2 changes: 2 additions & 0 deletions projects/rocfft/clients/tests/default_callbacks_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ struct Test_Callback
// complex data inputs and having only a load callback set.
// -------------------------------------------------------------------

#ifndef WIN32
TEST(rocfft_UnitTest, default_load_callback_complex_single)
{
if(hash_prob(random_seed, ::testing::UnitTest::GetInstance()->current_test_info()->name())
Expand Down Expand Up @@ -550,3 +551,4 @@ TEST(rocfft_UnitTest, default_store_callback_real_double)
DefaultCallbackType::STORE,
8);
}
#endif
9 changes: 6 additions & 3 deletions projects/rocfft/library/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,12 @@ add_library( rocfft
rocfft_add_coverage_flags( rocfft )

# rocFFT contains default implementations of callback functions that
# need to be built as relocatable device code
target_compile_options( rocfft PRIVATE -fgpu-rdc )
target_link_options( rocfft PRIVATE -fgpu-rdc )
# need to be built as relocatable device code (causes failure at link
# stage on Windows)
if (NOT WIN32)
target_compile_options( rocfft PRIVATE -fgpu-rdc )
target_link_options( rocfft PRIVATE -fgpu-rdc )
endif()

if( ROCFFT_MPI_ENABLE )
target_compile_definitions(rocfft PRIVATE ROCFFT_MPI_ENABLE)
Expand Down