diff --git a/test/ir/inference/inference_pass_test.py b/test/ir/inference/inference_pass_test.py index 34bdfb4d2c16c..ae823dfeea9ad 100644 --- a/test/ir/inference/inference_pass_test.py +++ b/test/ir/inference/inference_pass_test.py @@ -37,7 +37,7 @@ def __init__(self, methodName='runTest'): self.feeds = None self.fetch_list = None - self.enable_mkldnn = False + self.enable_onednn = False self.enable_onednn_bfloat16 = False self.enable_trt = False self.enable_tensorrt_varseqlen = False @@ -130,7 +130,7 @@ def _get_inference_outs(self, config): return outs def _get_analysis_config( - self, use_gpu=False, use_trt=False, use_mkldnn=False + self, use_gpu=False, use_trt=False, use_onednn=False ): ''' Return a new object of AnalysisConfig. @@ -178,7 +178,7 @@ def _get_analysis_config( if self.enable_tensorrt_varseqlen: config.enable_tensorrt_varseqlen() - elif use_mkldnn: + elif use_onednn: config.enable_onednn() if self.enable_onednn_bfloat16: config.enable_onednn_bfloat16() @@ -286,10 +286,10 @@ def check_output_with_option( ) # Check whether the onednn results and the CPU results are the same. - if (not use_gpu) and self.enable_mkldnn: + if (not use_gpu) and self.enable_onednn: onednn_outputs = self._get_inference_outs( self._get_analysis_config( - use_gpu=use_gpu, use_mkldnn=self.enable_mkldnn + use_gpu=use_gpu, use_onednn=self.enable_onednn ) ) diff --git a/test/ir/inference/quant_dequant_test.py b/test/ir/inference/quant_dequant_test.py index f955273a88667..1091e0282fb74 100644 --- a/test/ir/inference/quant_dequant_test.py +++ b/test/ir/inference/quant_dequant_test.py @@ -46,7 +46,7 @@ def __init__(self, methodName='runTest'): self.test_startup_program = paddle.static.Program() self.feeds = None self.fetch_list = None - self.enable_mkldnn = False + self.enable_onednn = False self.enable_onednn_bfloat16 = False self.enable_trt = False self.enable_tensorrt_varseqlen = True @@ -190,7 +190,7 @@ def _get_inference_outs(self, config): return outs def _get_analysis_config( - self, use_gpu=False, use_trt=False, use_mkldnn=False + self, use_gpu=False, use_trt=False, use_onednn=False ): ''' Return a new object of AnalysisConfig. @@ -230,7 +230,7 @@ def _get_analysis_config( if self.enable_tensorrt_varseqlen: config.enable_tensorrt_varseqlen() - elif use_mkldnn: + elif use_onednn: config.enable_onednn() if self.enable_onednn_bfloat16: config.enable_onednn_bfloat16() @@ -388,10 +388,10 @@ def check_output_with_option( ) # Check whether the onednn results and the CPU results are the same. - if (not use_gpu) and self.enable_mkldnn: + if (not use_gpu) and self.enable_onednn: onednn_outputs = self._get_inference_outs( self._get_analysis_config( - use_gpu=use_gpu, use_mkldnn=self.enable_mkldnn + use_gpu=use_gpu, use_onednn=self.enable_onednn ) ) diff --git a/test/ir/inference/test_conv_act_onednn_fuse_pass.py b/test/ir/inference/test_conv_act_onednn_fuse_pass.py index 8392b19875abf..4c7b0d2e1cc5a 100755 --- a/test/ir/inference/test_conv_act_onednn_fuse_pass.py +++ b/test/ir/inference/test_conv_act_onednn_fuse_pass.py @@ -207,7 +207,7 @@ def sample_program_config(self, draw): groups=groups, dilations=dilations, data_format=data_format, - use_mkldnn=True, + use_onednn=True, ) ops = [conv2d_op, act_op] diff --git a/test/ir/inference/test_conv_bn_fuse_pass.py b/test/ir/inference/test_conv_bn_fuse_pass.py index 9cfd09d53ca9e..d486100885825 100644 --- a/test/ir/inference/test_conv_bn_fuse_pass.py +++ b/test/ir/inference/test_conv_bn_fuse_pass.py @@ -108,7 +108,7 @@ def generate_bn_Var(): groups=groups, paddings=paddings, strides=strides, - use_mkldnn=use_onednn, + use_onednn=use_onednn, has_bias=False, is_test=True, ) @@ -158,7 +158,7 @@ def generate_bn_Var(): def sample_predictor_configs(self, program_config): # for onednn - if program_config.ops[0].attrs['use_mkldnn']: + if program_config.ops[0].attrs['use_onednn']: config = self.create_inference_config(use_onednn=True) yield config, ['fused_conv2d'], (1e-5, 1e-5) else: diff --git a/test/ir/inference/test_conv_transpose_bn_fuse_pass.py b/test/ir/inference/test_conv_transpose_bn_fuse_pass.py index 31e9bc9897381..99fddb614697e 100644 --- a/test/ir/inference/test_conv_transpose_bn_fuse_pass.py +++ b/test/ir/inference/test_conv_transpose_bn_fuse_pass.py @@ -67,7 +67,7 @@ def sample_program_config(self, draw): st.sampled_from(["EXPLICIT", "SAME", "VALID"]) ) random_data_layout = draw(st.sampled_from(["NCHW", "NHWC"])) - random_use_mkldnn = draw(st.booleans()) + random_use_onednn = draw(st.booleans()) random_output_size = [] random_filter = draw( st.lists( @@ -133,7 +133,7 @@ def generate_batch_norm_Variance(): 'data_format': random_data_layout, 'output_size': random_output_size, 'output_padding': random_output_size, - 'use_mkldnn': random_use_mkldnn, + 'use_mkldnn': random_use_onednn, 'is_test': True, }, ) @@ -160,7 +160,7 @@ def generate_batch_norm_Variance(): 'is_test': True, 'trainable_statistics': False, 'data_layout': random_data_layout, - 'use_mkldnn': random_use_mkldnn, + 'use_mkldnn': random_use_onednn, }, ) diff --git a/test/ir/inference/test_conv_transpose_eltwiseadd_bn_fuse_pass.py b/test/ir/inference/test_conv_transpose_eltwiseadd_bn_fuse_pass.py index 50b19a7ffba3a..216b661156b76 100644 --- a/test/ir/inference/test_conv_transpose_eltwiseadd_bn_fuse_pass.py +++ b/test/ir/inference/test_conv_transpose_eltwiseadd_bn_fuse_pass.py @@ -71,7 +71,7 @@ def sample_program_config(self, draw): st.sampled_from(["EXPLICIT", "SAME", "VALID"]) ) random_data_layout = draw(st.sampled_from(["NCHW", "NHWC"])) - random_use_mkldnn = draw(st.booleans()) + random_use_onednn = draw(st.booleans()) random_output_size = [] random_filter = draw( st.lists( @@ -141,7 +141,7 @@ def generate_batch_norm_Variance(): 'data_format': random_data_layout, 'output_size': random_output_size, 'output_padding': random_output_size, - 'use_mkldnn': random_use_mkldnn, + 'use_mkldnn': random_use_onednn, 'is_test': True, }, ) @@ -182,7 +182,7 @@ def generate_batch_norm_Variance(): 'is_test': True, 'trainable_statistics': False, 'data_layout': random_data_layout, - 'use_mkldnn': random_use_mkldnn, + 'use_mkldnn': random_use_onednn, }, ) diff --git a/test/ir/inference/test_fc_elementwise_layernorm_fuse_pass.py b/test/ir/inference/test_fc_elementwise_layernorm_fuse_pass.py index 80cd83e79f833..cd01ad161725a 100644 --- a/test/ir/inference/test_fc_elementwise_layernorm_fuse_pass.py +++ b/test/ir/inference/test_fc_elementwise_layernorm_fuse_pass.py @@ -99,7 +99,7 @@ def sample_program_config(self, draw): padding_weights=False, activation_type="", use_quantizer=False, - use_mkldnn=False, + use_onednn=False, ) add_op = OpConfig( "elementwise_add", diff --git a/test/ir/inference/test_mkldnn_int8_scale_calculation_pass.py b/test/ir/inference/test_mkldnn_int8_scale_calculation_pass.py index 6c61d24ac269f..456a0781118b5 100644 --- a/test/ir/inference/test_mkldnn_int8_scale_calculation_pass.py +++ b/test/ir/inference/test_mkldnn_int8_scale_calculation_pass.py @@ -123,7 +123,7 @@ def sample_program_config(self, draw): bias_shape = [f_shape[0]] inputs = {} weights = {} - use_mkldnn = True + use_onednn = True has_bias = draw(st.booleans()) if has_bias: @@ -154,7 +154,7 @@ def sample_program_config(self, draw): groups=groups, dilations=dilations, data_format=data_format, - use_mkldnn=use_mkldnn, + use_onednn=use_onednn, mkldnn_data_type="int8", ) diff --git a/test/ir/inference/test_mkldnn_matmul_activation_fuse_pass.py b/test/ir/inference/test_mkldnn_matmul_activation_fuse_pass.py index eb73fa54ae680..e53c32bcdaf29 100644 --- a/test/ir/inference/test_mkldnn_matmul_activation_fuse_pass.py +++ b/test/ir/inference/test_mkldnn_matmul_activation_fuse_pass.py @@ -140,7 +140,7 @@ def generate_input(type): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ 'matmul_activation_onednn_fuse_pass', 'operator_scale_onednn_fuse_pass', diff --git a/test/ir/inference/test_mkldnn_matmul_elementwise_add_activation_fuse_pass.py b/test/ir/inference/test_mkldnn_matmul_elementwise_add_activation_fuse_pass.py index 278b2b4102cf2..252378c60b36d 100644 --- a/test/ir/inference/test_mkldnn_matmul_elementwise_add_activation_fuse_pass.py +++ b/test/ir/inference/test_mkldnn_matmul_elementwise_add_activation_fuse_pass.py @@ -131,7 +131,7 @@ def generate_input(): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ 'matmul_elementwise_add_onednn_fuse_pass', 'matmul_activation_onednn_fuse_pass', diff --git a/test/ir/inference/test_mkldnn_matmul_elementwise_add_fuse_pass.py b/test/ir/inference/test_mkldnn_matmul_elementwise_add_fuse_pass.py index 0f9db3a18eadb..96b978d88c5cf 100644 --- a/test/ir/inference/test_mkldnn_matmul_elementwise_add_fuse_pass.py +++ b/test/ir/inference/test_mkldnn_matmul_elementwise_add_fuse_pass.py @@ -74,7 +74,7 @@ def generate_input(): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, passes=['matmul_elementwise_add_onednn_fuse_pass'] + use_onednn=True, passes=['matmul_elementwise_add_onednn_fuse_pass'] ) yield config, ['fused_matmul'], (1e-5, 1e-5) @@ -137,7 +137,7 @@ def generate_input(): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, passes=['matmul_elementwise_add_onednn_fuse_pass'] + use_onednn=True, passes=['matmul_elementwise_add_onednn_fuse_pass'] ) yield config, ['fused_matmul'], (1e-5, 1e-5) @@ -203,7 +203,7 @@ def generate_input_redisual(): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, passes=['matmul_elementwise_add_onednn_fuse_pass'] + use_onednn=True, passes=['matmul_elementwise_add_onednn_fuse_pass'] ) yield config, ['fused_matmul'], (1e-5, 1e-5) diff --git a/test/ir/inference/test_mkldnn_matmul_v2_activation_fuse_pass.py b/test/ir/inference/test_mkldnn_matmul_v2_activation_fuse_pass.py index 7ac863e675ac7..017b7387e5c45 100644 --- a/test/ir/inference/test_mkldnn_matmul_v2_activation_fuse_pass.py +++ b/test/ir/inference/test_mkldnn_matmul_v2_activation_fuse_pass.py @@ -144,7 +144,7 @@ def generate_input(type): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ 'matmul_activation_onednn_fuse_pass', 'operator_scale_onednn_fuse_pass', diff --git a/test/ir/inference/test_mkldnn_scale_matmul_fuse_pass.py b/test/ir/inference/test_mkldnn_scale_matmul_fuse_pass.py index b4181a7e6580e..0d86d8385d0c2 100644 --- a/test/ir/inference/test_mkldnn_scale_matmul_fuse_pass.py +++ b/test/ir/inference/test_mkldnn_scale_matmul_fuse_pass.py @@ -137,7 +137,7 @@ def generate_input(attrs, type): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, passes=['scale_matmul_fuse_pass'] + use_onednn=True, passes=['scale_matmul_fuse_pass'] ) yield config, ['matmul'], (1e-5, 1e-5) diff --git a/test/ir/inference/test_onednn_conv_bias_fuse_pass.py b/test/ir/inference/test_onednn_conv_bias_fuse_pass.py index ac82c4997da3a..3a1435ad0bc0a 100644 --- a/test/ir/inference/test_onednn_conv_bias_fuse_pass.py +++ b/test/ir/inference/test_onednn_conv_bias_fuse_pass.py @@ -130,7 +130,7 @@ def sample_program_config(self, draw): conv_bias_shape = [] inputs = {} weights = {} - use_mkldnn = None + use_onednn = None conv_type = 'conv2d' if draw(st.booleans()): conv_bias_shape = [f_shape[0]] @@ -145,7 +145,7 @@ def sample_program_config(self, draw): 'bias': TensorConfig(shape=bias_shape), 'conv_bias': TensorConfig(shape=conv_bias_shape), } - use_mkldnn = True + use_onednn = True else: inputs = { 'Input': ['input_x'], @@ -155,7 +155,7 @@ def sample_program_config(self, draw): 'filter': TensorConfig(shape=f_shape), 'bias': TensorConfig(shape=bias_shape), } - use_mkldnn = False + use_onednn = False conv2d_op = OpConfig( conv_type, @@ -167,7 +167,7 @@ def sample_program_config(self, draw): groups=groups, dilations=dilations, data_format=data_format, - use_mkldnn=use_mkldnn, + use_onednn=use_onednn, ) add_op = OpConfig( diff --git a/test/ir/inference/test_onednn_conv_bn_fuse_pass.py b/test/ir/inference/test_onednn_conv_bn_fuse_pass.py index da95b32fcda80..18a4da54a5446 100644 --- a/test/ir/inference/test_onednn_conv_bn_fuse_pass.py +++ b/test/ir/inference/test_onednn_conv_bn_fuse_pass.py @@ -23,7 +23,7 @@ class TestOneDNNConvBnFusePass(PassAutoScanTest): def sample_program_config(self, draw): - use_mkldnn = True + use_onednn = True padding_algorithm = draw(st.sampled_from(["EXPLICIT", "SAME", "VALID"])) groups = draw(st.integers(min_value=1, max_value=3)) data_format = draw(st.sampled_from(["NCHW", "NHWC"])) @@ -78,7 +78,7 @@ def generate_data(shape): groups=groups, paddings=paddings, strides=strides, - use_mkldnn=use_mkldnn, + use_onednn=use_onednn, has_bias=False, is_test=True, ) diff --git a/test/ir/inference/test_onednn_elementwise_add_activation_fuse_pass.py b/test/ir/inference/test_onednn_elementwise_add_activation_fuse_pass.py index 3d396968a7601..3cf14d3c772c2 100644 --- a/test/ir/inference/test_onednn_elementwise_add_activation_fuse_pass.py +++ b/test/ir/inference/test_onednn_elementwise_add_activation_fuse_pass.py @@ -116,7 +116,7 @@ def generate_input(): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ 'elementwise_act_onednn_fuse_pass', 'operator_scale_onednn_fuse_pass', diff --git a/test/ir/inference/test_onednn_fc_activation_fuse_pass.py b/test/ir/inference/test_onednn_fc_activation_fuse_pass.py index 84517b6dfc854..01923c2c3031f 100644 --- a/test/ir/inference/test_onednn_fc_activation_fuse_pass.py +++ b/test/ir/inference/test_onednn_fc_activation_fuse_pass.py @@ -134,7 +134,7 @@ def generate_input(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ "fc_act_onednn_fuse_pass", "operator_scale_onednn_fuse_pass", diff --git a/test/ir/inference/test_onednn_fc_gru_fuse_pass.py b/test/ir/inference/test_onednn_fc_gru_fuse_pass.py index 1b2d7b0be6e4f..069ed1fe44169 100644 --- a/test/ir/inference/test_onednn_fc_gru_fuse_pass.py +++ b/test/ir/inference/test_onednn_fc_gru_fuse_pass.py @@ -103,7 +103,7 @@ def generate_input(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ 'onednn_placement_pass', 'fc_gru_fuse_pass', diff --git a/test/ir/inference/test_onednn_fc_lstm_fuse_pass.py b/test/ir/inference/test_onednn_fc_lstm_fuse_pass.py index 93e755f4032ff..933c3477ea833 100644 --- a/test/ir/inference/test_onednn_fc_lstm_fuse_pass.py +++ b/test/ir/inference/test_onednn_fc_lstm_fuse_pass.py @@ -107,7 +107,7 @@ def generate_data(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ 'onednn_placement_pass', 'fc_lstm_fuse_pass', diff --git a/test/ir/inference/test_onednn_multi_gru_fuse_pass.py b/test/ir/inference/test_onednn_multi_gru_fuse_pass.py index 1133504a149ca..9a5dbbf2273a8 100644 --- a/test/ir/inference/test_onednn_multi_gru_fuse_pass.py +++ b/test/ir/inference/test_onednn_multi_gru_fuse_pass.py @@ -121,7 +121,7 @@ def generate_bias(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=['multi_gru_fuse_pass'], ) yield config, ['multi_gru'], (1e-5, 1e-5) diff --git a/test/ir/inference/test_onednn_multi_gru_seq_fuse_pass.py b/test/ir/inference/test_onednn_multi_gru_seq_fuse_pass.py index dbb1439dda96c..43a7f1952c8bd 100644 --- a/test/ir/inference/test_onednn_multi_gru_seq_fuse_pass.py +++ b/test/ir/inference/test_onednn_multi_gru_seq_fuse_pass.py @@ -196,7 +196,7 @@ def generate_bias(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=['multi_gru_fuse_pass', 'multi_gru_seq_fuse_pass'], ) yield config, ['multi_gru'], (1e-5, 1e-5) diff --git a/test/ir/inference/test_onednn_operator_reshape2_fuse_pass.py b/test/ir/inference/test_onednn_operator_reshape2_fuse_pass.py index 758950be6ee67..abd8f90f09963 100644 --- a/test/ir/inference/test_onednn_operator_reshape2_fuse_pass.py +++ b/test/ir/inference/test_onednn_operator_reshape2_fuse_pass.py @@ -75,7 +75,7 @@ def generate_input(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ "operator_reshape2_onednn_fuse_pass", ], diff --git a/test/ir/inference/test_onednn_operator_unsqueeze2_fuse_pass.py b/test/ir/inference/test_onednn_operator_unsqueeze2_fuse_pass.py index d1f441f3444ca..f35c355eb0314 100644 --- a/test/ir/inference/test_onednn_operator_unsqueeze2_fuse_pass.py +++ b/test/ir/inference/test_onednn_operator_unsqueeze2_fuse_pass.py @@ -73,7 +73,7 @@ def generate_input(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ "operator_unsqueeze2_onednn_fuse_pass", ], @@ -138,7 +138,7 @@ def generate_input(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ "operator_unsqueeze2_onednn_fuse_pass", ], diff --git a/test/ir/inference/test_onednn_quant_transpose_dequant_fuse_pass.py b/test/ir/inference/test_onednn_quant_transpose_dequant_fuse_pass.py index 5c8f89bd5f806..1ffcbf37b1054 100644 --- a/test/ir/inference/test_onednn_quant_transpose_dequant_fuse_pass.py +++ b/test/ir/inference/test_onednn_quant_transpose_dequant_fuse_pass.py @@ -65,7 +65,7 @@ def generate_input(): 'use_mkldnn': True, 'mkldnn_data_type': 'int8', }, - use_mkldnn=True, + use_onednn=True, ) transpose2_op_2 = OpConfig( @@ -80,7 +80,7 @@ def generate_input(): 'use_mkldnn': True, 'mkldnn_data_type': 'int8', }, - use_mkldnn=True, + use_onednn=True, ) dequantize_op = OpConfig( @@ -106,7 +106,7 @@ def generate_input(): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=['quant_transpose2_dequant_onednn_fuse_pass'], ) yield config, ['fused_transpose', 'fused_transpose'], (1e-5, 1e-5) diff --git a/test/ir/inference/test_onednn_squeeze2_transpose2_fuse_pass.py b/test/ir/inference/test_onednn_squeeze2_transpose2_fuse_pass.py index 3387f244bd4e8..3b6f86d7d027d 100644 --- a/test/ir/inference/test_onednn_squeeze2_transpose2_fuse_pass.py +++ b/test/ir/inference/test_onednn_squeeze2_transpose2_fuse_pass.py @@ -78,7 +78,7 @@ def generate_input(shape): def sample_predictor_configs(self, program_config): config = self.create_inference_config( - use_mkldnn=True, + use_onednn=True, passes=[ "squeeze2_transpose2_onednn_fuse_pass", ],