diff --git a/onnxruntime/test/contrib_ops/moe_test.cc b/onnxruntime/test/contrib_ops/moe_test.cc index 7dbaadd51d..42f62981cb 100644 --- a/onnxruntime/test/contrib_ops/moe_test.cc +++ b/onnxruntime/test/contrib_ops/moe_test.cc @@ -16,9 +16,10 @@ static void RunMoETest(const std::vector& input, const std::vector const std::vector& fc2_experts_bias, const std::vector& output_data, int num_rows, int num_experts, int hidden_size, int inter_size, std::string activation_type, int normalize_routing_weights = 0, int top_k = 1, bool use_float16 = false) { - int min_cuda_architecture = use_float16 ? 700 : 0; + constexpr int min_cuda_arch = 700; + constexpr int max_cuda_arch = 900; - bool enable_cuda = HasCudaEnvironment(min_cuda_architecture); + bool enable_cuda = HasCudaEnvironment(min_cuda_arch) && !NeedSkipIfCudaArchGreaterEqualThan(max_cuda_arch); if (enable_cuda) { OpTester tester("MoE", 1, onnxruntime::kMSDomain); tester.AddAttribute("k", static_cast(top_k)); @@ -91,7 +92,10 @@ static void RunQMoETest(const std::vector& input, const std::vector& fc2_scales, const std::vector& fc3_scales, const std::vector& output_data, int num_rows, int num_experts, int hidden_size, int inter_size, std::string activation_type, int normalize_routing_weights = 0, int top_k = 1) { - bool enable_cuda = HasCudaEnvironment(700); + constexpr int min_cuda_arch = 700; + constexpr int max_cuda_arch = 900; + + bool enable_cuda = HasCudaEnvironment(min_cuda_arch) && !NeedSkipIfCudaArchGreaterEqualThan(max_cuda_arch); if (enable_cuda) { OpTester tester("QMoE", 1, onnxruntime::kMSDomain); tester.AddAttribute("k", static_cast(top_k));