Skip to content

Commit fb806ad

Browse files
fix FLAGS_torch_compatible_kernel to FLAGS_use_accuracy_compatible_kernel (PaddlePaddle#76231)
1 parent f83193c commit fb806ad

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

paddle/common/flags.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,12 +2305,12 @@ PHI_DEFINE_EXPORTED_bool(
23052305

23062306
/**
23072307
* Torch Compatible related FLAG
2308-
* Name: FLAGS_torch_compatible_kernel
2308+
* Name: FLAGS_use_accuracy_compatible_kernel
23092309
* Since Version: 3.2.2
23102310
* Value Range: bool, default=false
23112311
* Example:
23122312
* Note: Whether use torch compatible version kernel.
23132313
*/
2314-
PHI_DEFINE_EXPORTED_bool(torch_compatible_kernel,
2314+
PHI_DEFINE_EXPORTED_bool(use_accuracy_compatible_kernel,
23152315
false,
23162316
"Whether use torch compatible version kernel.");

paddle/fluid/pir/transforms/pd_op_to_kernel_pass.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ COMMON_DECLARE_bool(use_onednn);
7474

7575
COMMON_DECLARE_bool(print_ir);
7676
COMMON_DECLARE_bool(enable_collect_shape);
77-
COMMON_DECLARE_bool(torch_compatible_kernel);
77+
COMMON_DECLARE_bool(use_accuracy_compatible_kernel);
7878
REGISTER_FILE_SYMBOLS(pd_op_to_kernel_pass);
7979
namespace paddle::dialect {
8080

@@ -283,7 +283,7 @@ static bool NeedFallBackFromGPUDNN2GPU(pir::Operation* op,
283283
}
284284
} else if ((op->isa<AffineGridOp>() || op->isa<AffineGridGradOp>()) &&
285285
kernel_key.backend() == phi::Backend::GPUDNN) {
286-
if (FLAGS_torch_compatible_kernel) {
286+
if (FLAGS_use_accuracy_compatible_kernel) {
287287
return true;
288288
}
289289
bool use_cudnn = true;

paddle/phi/kernels/funcs/pooling.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ limitations under the License. */
3131
#include "paddle/phi/kernels/funcs/random.cuh"
3232
#include "paddle/phi/kernels/funcs/reduce_function.h"
3333

34-
COMMON_DECLARE_bool(torch_compatible_kernel);
34+
COMMON_DECLARE_bool(use_accuracy_compatible_kernel);
3535

3636
namespace phi {
3737
namespace funcs {
@@ -988,7 +988,7 @@ class MaxPool2dGradFunctor<phi::GPUContext, T> {
988988
output.numel() <= std::numeric_limits<int>::max()) {
989989
auto pool_divmods = FastDivModForPooling<int>(
990990
input_channels, output_width, output_height);
991-
if (FLAGS_torch_compatible_kernel) {
991+
if (FLAGS_use_accuracy_compatible_kernel) {
992992
int64_t blocks =
993993
(input_width * input_height + kBlockThreads - 1) / kBlockThreads;
994994
dim3 grid(blocks, batch_size, input_channels);
@@ -1042,7 +1042,7 @@ class MaxPool2dGradFunctor<phi::GPUContext, T> {
10421042
} else {
10431043
auto pool_divmods = FastDivModForPooling<int64_t>(
10441044
input_channels, output_width, output_height);
1045-
if (FLAGS_torch_compatible_kernel) {
1045+
if (FLAGS_use_accuracy_compatible_kernel) {
10461046
int64_t blocks =
10471047
(input_width * input_height + kBlockThreads - 1) / kBlockThreads;
10481048
dim3 grid(blocks, batch_size, input_channels);

python/paddle/nn/functional/vision.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def affine_grid(
100100
False # ROCM platform do not have MIOPEN kernel for affine_grid
101101
)
102102

103-
if paddle.get_flags(["FLAGS_torch_compatible_kernel"]).get(
104-
"FLAGS_torch_compatible_kernel", False
103+
if paddle.get_flags(["FLAGS_use_accuracy_compatible_kernel"]).get(
104+
"FLAGS_use_accuracy_compatible_kernel", False
105105
):
106106
use_cudnn = False
107107

test/legacy_test/test_affine_grid_op.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def run(place):
253253

254254
class TestAffineGridOpTorchCompatible1(TestAffineGridOp):
255255
def initTestCase(self):
256-
paddle.set_flags({'FLAGS_torch_compatible_kernel': 1})
256+
paddle.set_flags({'FLAGS_use_accuracy_compatible_kernel': 1})
257257
self.theta_shape = (20, 2, 3)
258258
self.output_shape = np.array([20, 2, 5, 7]).astype("int32")
259259
self.dynamic_shape = True
@@ -263,7 +263,7 @@ def initTestCase(self):
263263

264264
class TestAffineGridOpTorchCompatible2(TestAffineGridOp):
265265
def initTestCase(self):
266-
paddle.set_flags({'FLAGS_torch_compatible_kernel': 1})
266+
paddle.set_flags({'FLAGS_use_accuracy_compatible_kernel': 1})
267267
self.theta_shape = (20, 3, 4)
268268
self.output_shape = np.array([20, 1, 2, 5, 7]).astype("int32")
269269
self.dynamic_shape = True

test/legacy_test/test_pool2d_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def test_pool2d_static(self):
770770
paddle.disable_static()
771771

772772
def test_torch_compatible(self):
773-
paddle.set_flags({'FLAGS_torch_compatible_kernel': 1})
773+
paddle.set_flags({'FLAGS_use_accuracy_compatible_kernel': 1})
774774
paddle.enable_static()
775775
for place in self.places:
776776
self.check_max_static_results(place)

0 commit comments

Comments
 (0)