From 2a99c77ffdc6ddb43fda5fd44bcfd2c6c82f67f0 Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Thu, 3 Oct 2024 15:54:52 +0100 Subject: [PATCH] [HIPIFY][rocRAND][feature] Support for `cuRAND -> rocRAND` hipification - Step 11 - Data Types + Updated synthetic tests for `rocRAND` and `hipRAND`, the regenerated `hipify-perl`, and `RAND` `CUDA2HIP` documentation --- bin/hipify-perl | 14 ++ .../CURAND_API_supported_by_HIP_and_ROC.md | 28 ++-- docs/tables/CURAND_API_supported_by_ROC.md | 28 ++-- src/CUDA2HIP_RAND_API_types.cpp | 120 ++++++++++-------- .../synthetic/libraries/curand2hiprand.cu | 20 +++ .../synthetic/libraries/curand2rocrand.cu | 40 +++++- 6 files changed, 168 insertions(+), 82 deletions(-) diff --git a/bin/hipify-perl b/bin/hipify-perl index ce824637..9c6d66df 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -2808,6 +2808,20 @@ sub rocSubstitutions { subst("curandOrdering_t", "rocrand_ordering", "type"); subst("curandRngType", "rocrand_rng_type", "type"); subst("curandRngType_t", "rocrand_rng_type", "type"); + subst("curandStateMRG32k3a", "rocrand_device::mrg32k3a_engine", "type"); + subst("curandStateMRG32k3a_t", "rocrand_state_mrg32k3a", "type"); + subst("curandStateMtgp32", "rocrand_device::mtgp32_engine", "type"); + subst("curandStateMtgp32_t", "rocrand_state_mtgp32", "type"); + subst("curandStatePhilox4_32_10", "rocrand_device::philox4x32_10_engine", "type"); + subst("curandStatePhilox4_32_10_t", "rocrand_state_philox4x32_10", "type"); + subst("curandStateScrambledSobol32", "rocrand_device::scrambled_sobol32_engine", "type"); + subst("curandStateScrambledSobol32_t", "rocrand_state_scrambled_sobol32", "type"); + subst("curandStateScrambledSobol64", "rocrand_device::scrambled_sobol64_engine", "type"); + subst("curandStateScrambledSobol64_t", "rocrand_state_scrambled_sobol64", "type"); + subst("curandStateSobol32", "rocrand_device::sobol32_engine", "type"); + subst("curandStateSobol32_t", "rocrand_state_sobol32", "type"); + subst("curandStateSobol64", "rocrand_device::sobol64_engine", "type"); + subst("curandStateSobol64_t", "rocrand_state_sobol64", "type"); subst("curandStatus", "rocrand_status", "type"); subst("curandStatus_t", "rocrand_status", "type"); subst("cusolverDnHandle_t", "rocblas_handle", "type"); diff --git a/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md b/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md index 6996494d..8bae3a0e 100644 --- a/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md @@ -80,20 +80,20 @@ |`curandRngType`| | | | |`hiprandRngType_t`|1.5.0| | | | |`rocrand_rng_type`|1.5.0| | | | | |`curandRngType_t`| | | | |`hiprandRngType_t`|1.5.0| | | | |`rocrand_rng_type`|1.5.0| | | | | |`curandState`| | | | |`hiprandState`|1.8.0| | | | | | | | | | | -|`curandStateMRG32k3a`| | | | |`hiprandStateMRG32k3a`|1.8.0| | | | | | | | | | | -|`curandStateMRG32k3a_t`| | | | |`hiprandStateMRG32k3a_t`|1.5.0| | | | | | | | | | | -|`curandStateMtgp32`| | | | |`hiprandStateMtgp32`|1.8.0| | | | | | | | | | | -|`curandStateMtgp32_t`| | | | |`hiprandStateMtgp32_t`|1.5.0| | | | | | | | | | | -|`curandStatePhilox4_32_10`| | | | |`hiprandStatePhilox4_32_10`|1.8.0| | | | | | | | | | | -|`curandStatePhilox4_32_10_t`| | | | |`hiprandStatePhilox4_32_10_t`|1.8.0| | | | | | | | | | | -|`curandStateScrambledSobol32`| | | | |`hiprandStateScrambledSobol32`|6.2.0| | | | | | | | | | | -|`curandStateScrambledSobol32_t`| | | | |`hiprandStateScrambledSobol32_t`|6.2.0| | | | | | | | | | | -|`curandStateScrambledSobol64`| | | | |`hiprandStateScrambledSobol64`|6.2.0| | | | | | | | | | | -|`curandStateScrambledSobol64_t`| | | | |`hiprandStateScrambledSobol64_t`|6.2.0| | | | | | | | | | | -|`curandStateSobol32`| | | | |`hiprandStateSobol32`|1.8.0| | | | | | | | | | | -|`curandStateSobol32_t`| | | | |`hiprandStateSobol32_t`|1.5.0| | | | | | | | | | | -|`curandStateSobol64`| | | | |`hiprandStateSobol64`|6.2.0| | | | | | | | | | | -|`curandStateSobol64_t`| | | | |`hiprandStateSobol64_t`|6.2.0| | | | | | | | | | | +|`curandStateMRG32k3a`| | | | |`hiprandStateMRG32k3a`|1.8.0| | | | |`rocrand_device::mrg32k3a_engine`|1.5.0| | | | | +|`curandStateMRG32k3a_t`| | | | |`hiprandStateMRG32k3a_t`|1.5.0| | | | |`rocrand_state_mrg32k3a`|1.5.0| | | | | +|`curandStateMtgp32`| | | | |`hiprandStateMtgp32`|1.8.0| | | | |`rocrand_device::mtgp32_engine`|1.5.0| | | | | +|`curandStateMtgp32_t`| | | | |`hiprandStateMtgp32_t`|1.5.0| | | | |`rocrand_state_mtgp32`|1.5.0| | | | | +|`curandStatePhilox4_32_10`| | | | |`hiprandStatePhilox4_32_10`|1.8.0| | | | |`rocrand_device::philox4x32_10_engine`|1.5.0| | | | | +|`curandStatePhilox4_32_10_t`| | | | |`hiprandStatePhilox4_32_10_t`|1.8.0| | | | |`rocrand_state_philox4x32_10`|1.5.0| | | | | +|`curandStateScrambledSobol32`| | | | |`hiprandStateScrambledSobol32`|6.2.0| | | | |`rocrand_device::scrambled_sobol32_engine`|5.4.0| | | | | +|`curandStateScrambledSobol32_t`| | | | |`hiprandStateScrambledSobol32_t`|6.2.0| | | | |`rocrand_state_scrambled_sobol32`|5.4.0| | | | | +|`curandStateScrambledSobol64`| | | | |`hiprandStateScrambledSobol64`|6.2.0| | | | |`rocrand_device::scrambled_sobol64_engine`|5.4.0| | | | | +|`curandStateScrambledSobol64_t`| | | | |`hiprandStateScrambledSobol64_t`|6.2.0| | | | |`rocrand_state_scrambled_sobol64`|5.4.0| | | | | +|`curandStateSobol32`| | | | |`hiprandStateSobol32`|1.8.0| | | | |`rocrand_device::sobol32_engine`|1.5.0| | | | | +|`curandStateSobol32_t`| | | | |`hiprandStateSobol32_t`|1.5.0| | | | |`rocrand_state_sobol32`|1.5.0| | | | | +|`curandStateSobol64`| | | | |`hiprandStateSobol64`|6.2.0| | | | |`rocrand_device::sobol64_engine`|4.5.0| | | | | +|`curandStateSobol64_t`| | | | |`hiprandStateSobol64_t`|6.2.0| | | | |`rocrand_state_sobol64`|4.5.0| | | | | |`curandStateXORWOW`| | | | |`hiprandStateXORWOW`|1.8.0| | | | | | | | | | | |`curandStateXORWOW_t`| | | | |`hiprandStateXORWOW_t`|1.5.0| | | | | | | | | | | |`curandState_t`| | | | |`hiprandState_t`|1.5.0| | | | | | | | | | | diff --git a/docs/tables/CURAND_API_supported_by_ROC.md b/docs/tables/CURAND_API_supported_by_ROC.md index 14947bb6..5b63491c 100644 --- a/docs/tables/CURAND_API_supported_by_ROC.md +++ b/docs/tables/CURAND_API_supported_by_ROC.md @@ -80,20 +80,20 @@ |`curandRngType`| | | | |`rocrand_rng_type`|1.5.0| | | | | |`curandRngType_t`| | | | |`rocrand_rng_type`|1.5.0| | | | | |`curandState`| | | | | | | | | | | -|`curandStateMRG32k3a`| | | | | | | | | | | -|`curandStateMRG32k3a_t`| | | | | | | | | | | -|`curandStateMtgp32`| | | | | | | | | | | -|`curandStateMtgp32_t`| | | | | | | | | | | -|`curandStatePhilox4_32_10`| | | | | | | | | | | -|`curandStatePhilox4_32_10_t`| | | | | | | | | | | -|`curandStateScrambledSobol32`| | | | | | | | | | | -|`curandStateScrambledSobol32_t`| | | | | | | | | | | -|`curandStateScrambledSobol64`| | | | | | | | | | | -|`curandStateScrambledSobol64_t`| | | | | | | | | | | -|`curandStateSobol32`| | | | | | | | | | | -|`curandStateSobol32_t`| | | | | | | | | | | -|`curandStateSobol64`| | | | | | | | | | | -|`curandStateSobol64_t`| | | | | | | | | | | +|`curandStateMRG32k3a`| | | | |`rocrand_device::mrg32k3a_engine`|1.5.0| | | | | +|`curandStateMRG32k3a_t`| | | | |`rocrand_state_mrg32k3a`|1.5.0| | | | | +|`curandStateMtgp32`| | | | |`rocrand_device::mtgp32_engine`|1.5.0| | | | | +|`curandStateMtgp32_t`| | | | |`rocrand_state_mtgp32`|1.5.0| | | | | +|`curandStatePhilox4_32_10`| | | | |`rocrand_device::philox4x32_10_engine`|1.5.0| | | | | +|`curandStatePhilox4_32_10_t`| | | | |`rocrand_state_philox4x32_10`|1.5.0| | | | | +|`curandStateScrambledSobol32`| | | | |`rocrand_device::scrambled_sobol32_engine`|5.4.0| | | | | +|`curandStateScrambledSobol32_t`| | | | |`rocrand_state_scrambled_sobol32`|5.4.0| | | | | +|`curandStateScrambledSobol64`| | | | |`rocrand_device::scrambled_sobol64_engine`|5.4.0| | | | | +|`curandStateScrambledSobol64_t`| | | | |`rocrand_state_scrambled_sobol64`|5.4.0| | | | | +|`curandStateSobol32`| | | | |`rocrand_device::sobol32_engine`|1.5.0| | | | | +|`curandStateSobol32_t`| | | | |`rocrand_state_sobol32`|1.5.0| | | | | +|`curandStateSobol64`| | | | |`rocrand_device::sobol64_engine`|4.5.0| | | | | +|`curandStateSobol64_t`| | | | |`rocrand_state_sobol64`|4.5.0| | | | | |`curandStateXORWOW`| | | | | | | | | | | |`curandStateXORWOW_t`| | | | | | | | | | | |`curandState_t`| | | | | | | | | | | diff --git a/src/CUDA2HIP_RAND_API_types.cpp b/src/CUDA2HIP_RAND_API_types.cpp index 746389a2..0184a0a6 100644 --- a/src/CUDA2HIP_RAND_API_types.cpp +++ b/src/CUDA2HIP_RAND_API_types.cpp @@ -79,63 +79,63 @@ const std::map CUDA_RAND_TYPE_NAME_MAP { {"curandGenerator_st", {"hiprandGenerator_st", "rocrand_generator_base_type", CONV_TYPE, API_RAND, 1}}, {"curandGenerator_t", {"hiprandGenerator_t", "rocrand_generator", CONV_TYPE, API_RAND, 1}}, - {"curandDistribution_st", {"hiprandDistribution_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, - {"curandDistribution_t", {"hiprandDistribution_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, - - {"curandHistogramM2V_st", {"hiprandHistogramM2V_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, - {"curandHistogramM2V_t", {"hiprandHistogramM2V_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, - - {"curandDistributionShift_st", {"hiprandDistributionShift_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, - {"curandDistributionShift_t", {"hiprandDistributionShift_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, - - {"curandDistributionM2Shift_st", {"hiprandDistributionM2Shift_st", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandDistributionM2Shift_t", {"hiprandDistributionM2Shift_t", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandHistogramM2_st", {"hiprandHistogramM2_st", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandHistogramM2_t", {"hiprandHistogramM2_t", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandHistogramM2K_st", {"hiprandHistogramM2K_st", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandHistogramM2K_t", {"hiprandHistogramM2K_t", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandDiscreteDistribution_st", {"hiprandDiscreteDistribution_st", "rocrand_discrete_distribution_st", CONV_TYPE, API_RAND, 1}}, - {"curandDiscreteDistribution_t", {"hiprandDiscreteDistribution_t", "rocrand_discrete_distribution", CONV_TYPE, API_RAND, 1}}, - {"curandMethod", {"hiprandMethod_t", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandMethod_t", {"hiprandMethod_t", "", CONV_TYPE, API_RAND, 1, HIP_UNSUPPORTED}}, - {"curandDirectionVectors32_t", {"hiprandDirectionVectors32_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandDirectionVectors64_t", {"hiprandDirectionVectors64_t", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, + {"curandDistribution_st", {"hiprandDistribution_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandDistribution_t", {"hiprandDistribution_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + + {"curandHistogramM2V_st", {"hiprandHistogramM2V_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandHistogramM2V_t", {"hiprandHistogramM2V_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + + {"curandDistributionShift_st", {"hiprandDistributionShift_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandDistributionShift_t", {"hiprandDistributionShift_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + + {"curandDistributionM2Shift_st", {"hiprandDistributionM2Shift_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandDistributionM2Shift_t", {"hiprandDistributionM2Shift_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandHistogramM2_st", {"hiprandHistogramM2_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandHistogramM2_t", {"hiprandHistogramM2_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandHistogramM2K_st", {"hiprandHistogramM2K_st", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandHistogramM2K_t", {"hiprandHistogramM2K_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandDiscreteDistribution_st", {"hiprandDiscreteDistribution_st", "rocrand_discrete_distribution_st", CONV_TYPE, API_RAND, 1}}, + {"curandDiscreteDistribution_t", {"hiprandDiscreteDistribution_t", "rocrand_discrete_distribution", CONV_TYPE, API_RAND, 1}}, + {"curandMethod", {"hiprandMethod_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandMethod_t", {"hiprandMethod_t", "", CONV_TYPE, API_RAND, 1, UNSUPPORTED}}, + {"curandDirectionVectors32_t", {"hiprandDirectionVectors32_t", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, + {"curandDirectionVectors64_t", {"hiprandDirectionVectors64_t", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, // RAND types for Device functions - {"curandStateMtgp32", {"hiprandStateMtgp32", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateMtgp32_t", {"hiprandStateMtgp32_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateScrambledSobol64", {"hiprandStateScrambledSobol64", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateScrambledSobol64_t", {"hiprandStateScrambledSobol64_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateSobol64", {"hiprandStateSobol64", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateSobol64_t", {"hiprandStateSobol64_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateScrambledSobol32", {"hiprandStateScrambledSobol32", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateScrambledSobol32_t", {"hiprandStateScrambledSobol32_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateSobol32", {"hiprandStateSobol32", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateSobol32_t", {"hiprandStateSobol32_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateMRG32k3a", {"hiprandStateMRG32k3a", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateMRG32k3a_t", {"hiprandStateMRG32k3a_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStatePhilox4_32_10", {"hiprandStatePhilox4_32_10", "", CONV_TYPE, API_RAND, 1}}, - {"curandStatePhilox4_32_10_t", {"hiprandStatePhilox4_32_10_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateXORWOW", {"hiprandStateXORWOW", "", CONV_TYPE, API_RAND, 1}}, - {"curandStateXORWOW_t", {"hiprandStateXORWOW_t", "", CONV_TYPE, API_RAND, 1}}, - {"curandState", {"hiprandState", "", CONV_TYPE, API_RAND, 1}}, - {"curandState_t", {"hiprandState_t", "", CONV_TYPE, API_RAND, 1}}, + {"curandStateMtgp32", {"hiprandStateMtgp32", "rocrand_device::mtgp32_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStateMtgp32_t", {"hiprandStateMtgp32_t", "rocrand_state_mtgp32", CONV_TYPE, API_RAND, 1}}, + {"curandStateScrambledSobol64", {"hiprandStateScrambledSobol64", "rocrand_device::scrambled_sobol64_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStateScrambledSobol64_t", {"hiprandStateScrambledSobol64_t", "rocrand_state_scrambled_sobol64", CONV_TYPE, API_RAND, 1}}, + {"curandStateSobol64", {"hiprandStateSobol64", "rocrand_device::sobol64_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStateSobol64_t", {"hiprandStateSobol64_t", "rocrand_state_sobol64", CONV_TYPE, API_RAND, 1}}, + {"curandStateScrambledSobol32", {"hiprandStateScrambledSobol32", "rocrand_device::scrambled_sobol32_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStateScrambledSobol32_t", {"hiprandStateScrambledSobol32_t", "rocrand_state_scrambled_sobol32", CONV_TYPE, API_RAND, 1}}, + {"curandStateSobol32", {"hiprandStateSobol32", "rocrand_device::sobol32_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStateSobol32_t", {"hiprandStateSobol32_t", "rocrand_state_sobol32", CONV_TYPE, API_RAND, 1}}, + {"curandStateMRG32k3a", {"hiprandStateMRG32k3a", "rocrand_device::mrg32k3a_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStateMRG32k3a_t", {"hiprandStateMRG32k3a_t", "rocrand_state_mrg32k3a", CONV_TYPE, API_RAND, 1}}, + {"curandStatePhilox4_32_10", {"hiprandStatePhilox4_32_10", "rocrand_device::philox4x32_10_engine", CONV_TYPE, API_RAND, 1}}, + {"curandStatePhilox4_32_10_t", {"hiprandStatePhilox4_32_10_t", "rocrand_state_philox4x32_10", CONV_TYPE, API_RAND, 1}}, + {"curandStateXORWOW", {"hiprandStateXORWOW", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, + {"curandStateXORWOW_t", {"hiprandStateXORWOW_t", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, + {"curandState", {"hiprandState", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, + {"curandState_t", {"hiprandState_t", "", CONV_TYPE, API_RAND, 1, ROC_UNSUPPORTED}}, // RAND method (enum curandMethod) - {"CURAND_CHOOSE_BEST", {"HIPRAND_CHOOSE_BEST", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_ITR", {"HIPRAND_ITR", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_KNUTH", {"HIPRAND_KNUTH", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_HITR", {"HIPRAND_HITR", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_M1", {"HIPRAND_M1", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_M2", {"HIPRAND_M2", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_BINARY_SEARCH", {"HIPRAND_BINARY_SEARCH", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_DISCRETE_GAUSS", {"HIPRAND_DISCRETE_GAUSS", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_REJECTION", {"HIPRAND_REJECTION", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_DEVICE_API", {"HIPRAND_DEVICE_API", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_FAST_REJECTION", {"HIPRAND_FAST_REJECTION", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_3RD", {"HIPRAND_3RD", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_DEFINITION", {"HIPRAND_DEFINITION", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, - {"CURAND_POISSON", {"HIPRAND_POISSON", "", CONV_NUMERIC_LITERAL, API_RAND, 1, HIP_UNSUPPORTED}}, + {"CURAND_CHOOSE_BEST", {"HIPRAND_CHOOSE_BEST", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_ITR", {"HIPRAND_ITR", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_KNUTH", {"HIPRAND_KNUTH", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_HITR", {"HIPRAND_HITR", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_M1", {"HIPRAND_M1", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_M2", {"HIPRAND_M2", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_BINARY_SEARCH", {"HIPRAND_BINARY_SEARCH", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_DISCRETE_GAUSS", {"HIPRAND_DISCRETE_GAUSS", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_REJECTION", {"HIPRAND_REJECTION", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_DEVICE_API", {"HIPRAND_DEVICE_API", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_FAST_REJECTION", {"HIPRAND_FAST_REJECTION", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_3RD", {"HIPRAND_3RD", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_DEFINITION", {"HIPRAND_DEFINITION", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, + {"CURAND_POISSON", {"HIPRAND_POISSON", "", CONV_NUMERIC_LITERAL, API_RAND, 1, UNSUPPORTED}}, }; const std::map CUDA_RAND_TYPE_NAME_VER_MAP { @@ -249,4 +249,18 @@ const std::map HIP_RAND_TYPE_NAME_VER_MAP { {"rocrand_generator", {HIP_1050, HIP_0, HIP_0 }}, {"rocrand_discrete_distribution_st", {HIP_1050, HIP_0, HIP_0 }}, {"rocrand_discrete_distribution", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_device::philox4x32_10_engine", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_state_philox4x32_10", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_device::mtgp32_engine", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_state_mtgp32", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_device::scrambled_sobol32_engine", {HIP_5040, HIP_0, HIP_0 }}, + {"rocrand_state_scrambled_sobol32", {HIP_5040, HIP_0, HIP_0 }}, + {"rocrand_device::scrambled_sobol64_engine", {HIP_5040, HIP_0, HIP_0 }}, + {"rocrand_state_scrambled_sobol64", {HIP_5040, HIP_0, HIP_0 }}, + {"rocrand_device::sobol32_engine", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_state_sobol32", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_device::sobol64_engine", {HIP_4050, HIP_0, HIP_0 }}, + {"rocrand_state_sobol64", {HIP_4050, HIP_0, HIP_0 }}, + {"rocrand_device::mrg32k3a_engine", {HIP_1050, HIP_0, HIP_0 }}, + {"rocrand_state_mrg32k3a", {HIP_1050, HIP_0, HIP_0 }}, }; diff --git a/tests/unit_tests/synthetic/libraries/curand2hiprand.cu b/tests/unit_tests/synthetic/libraries/curand2hiprand.cu index 42f12264..4b43299e 100644 --- a/tests/unit_tests/synthetic/libraries/curand2hiprand.cu +++ b/tests/unit_tests/synthetic/libraries/curand2hiprand.cu @@ -125,6 +125,11 @@ int main() { curandStateScrambledSobol64 randStateScrambledSobol64; curandStateScrambledSobol64_t randStateScrambledSobol64_t; + // CHECK: hiprandStateSobol32 randStateSobol32; + // CHECK-NEXT: hiprandStateSobol32_t randStateSobol32_t; + curandStateSobol32 randStateSobol32; + curandStateSobol32_t randStateSobol32_t; + // CHECK: hiprandStateScrambledSobol32 randStateScrambledSobol32; // CHECK-NEXT: hiprandStateScrambledSobol32_t randStateScrambledSobol32_t; curandStateScrambledSobol32 randStateScrambledSobol32; @@ -142,6 +147,21 @@ int main() { curandDiscreteDistribution_st *discreteDistribution_st = nullptr; curandDiscreteDistribution_t discreteDistribution_t = nullptr; + // CHECK: hiprandStateMtgp32 stateMtgp32; + // CHECK-NEXT: hiprandStateMtgp32_t stateMtgp32_t; + curandStateMtgp32 stateMtgp32; + curandStateMtgp32_t stateMtgp32_t; + + // CHECK: hiprandStateMRG32k3a stateMRG32k3a; + // CHECK-NEXT: hiprandStateMRG32k3a_t stateMRG32k3a_t; + curandStateMRG32k3a stateMRG32k3a; + curandStateMRG32k3a_t stateMRG32k3a_t; + + // CHECK: hiprandStatePhilox4_32_10 statePhilox4_32_10; + // CHECK-NEXT: hiprandStatePhilox4_32_10_t statePhilox4_32_10_t; + curandStatePhilox4_32_10 statePhilox4_32_10; + curandStatePhilox4_32_10_t statePhilox4_32_10_t; + // CHECK: hiprandDirectionVectorSet_t directionVectorSet; // CHECK-NEXT: hiprandDirectionVectorSet_t directionVectorSet_t; // CHECK-NEXT: hiprandDirectionVectorSet_t DIRECTION_VECTORS_32_JOEKUO6 = HIPRAND_DIRECTION_VECTORS_32_JOEKUO6; diff --git a/tests/unit_tests/synthetic/libraries/curand2rocrand.cu b/tests/unit_tests/synthetic/libraries/curand2rocrand.cu index 6ac38f91..93a168c0 100644 --- a/tests/unit_tests/synthetic/libraries/curand2rocrand.cu +++ b/tests/unit_tests/synthetic/libraries/curand2rocrand.cu @@ -4,8 +4,11 @@ #include #include // CHECK: #include "rocrand/rocrand.h" +// CHECK-NEXT: #include "rocrand/rocrand_kernel.h" #include "curand.h" +#include "curand_kernel.h" // CHECK-NOT: #include "rocrand/rocrand.h" +// CHECK-NOT: #include "rocrand/rocrand_kernel.h" int main() { printf("21.1. cuRAND API to rocRAND API synthetic test\n"); @@ -110,11 +113,46 @@ int main() { curandGenerator_st *randGenerator_st = nullptr; curandGenerator_t randGenerator; + // CHECK: rocrand_device::sobol64_engine randStateSobol64; + // CHECK-NEXT: rocrand_state_sobol64 randStateSobol64_t; + curandStateSobol64 randStateSobol64; + curandStateSobol64_t randStateSobol64_t; + + // CHECK: rocrand_device::scrambled_sobol64_engine randStateScrambledSobol64; + // CHECK-NEXT: rocrand_state_scrambled_sobol64 randStateScrambledSobol64_t; + curandStateScrambledSobol64 randStateScrambledSobol64; + curandStateScrambledSobol64_t randStateScrambledSobol64_t; + + // CHECK: rocrand_device::sobol32_engine randStateSobol32; + // CHECK-NEXT: rocrand_state_sobol32 randStateSobol32_t; + curandStateSobol32 randStateSobol32; + curandStateSobol32_t randStateSobol32_t; + + // CHECK: rocrand_device::scrambled_sobol32_engine randStateScrambledSobol32; + // CHECK-NEXT: rocrand_state_scrambled_sobol32 randStateScrambledSobol32_t; + curandStateScrambledSobol32 randStateScrambledSobol32; + curandStateScrambledSobol32_t randStateScrambledSobol32_t; + // CHECK: rocrand_discrete_distribution_st *discreteDistribution_st = nullptr; - // CHECK: rocrand_discrete_distribution discreteDistribution_t = nullptr; + // CHECK-NEXT: rocrand_discrete_distribution discreteDistribution_t = nullptr; curandDiscreteDistribution_st *discreteDistribution_st = nullptr; curandDiscreteDistribution_t discreteDistribution_t = nullptr; + // CHECK: rocrand_device::mtgp32_engine stateMtgp32; + // CHECK-NEXT: rocrand_state_mtgp32 stateMtgp32_t; + curandStateMtgp32 stateMtgp32; + curandStateMtgp32_t stateMtgp32_t; + + // CHECK: rocrand_device::mrg32k3a_engine stateMRG32k3a; + // CHECK-NEXT: rocrand_state_mrg32k3a stateMRG32k3a_t; + curandStateMRG32k3a stateMRG32k3a; + curandStateMRG32k3a_t stateMRG32k3a_t; + + // CHECK: rocrand_device::philox4x32_10_engine statePhilox4_32_10; + // CHECK-NEXT: rocrand_state_philox4x32_10 statePhilox4_32_10_t; + curandStatePhilox4_32_10 statePhilox4_32_10; + curandStatePhilox4_32_10_t statePhilox4_32_10_t; + // CUDA: curandStatus_t CURANDAPI curandCreateGenerator(curandGenerator_t *generator, curandRngType_t rng_type); // ROC: rocrand_status ROCRANDAPI rocrand_create_generator(rocrand_generator * generator, rocrand_rng_type rng_type); // CHECK: status = rocrand_create_generator(&randGenerator, randRngType_t);