Skip to content

Commit 9258294

Browse files
authored
【paddle_test No.3】replace cc_test with paddle_test (#60832)
* Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update cf_dialect.h * Update cf_dialect.h * Update pd_op_to_kernel_pass.h * Update op_gen.py * Update op_gen.py * Update control_flow_op.h * Update control_flow_op.h * Update kernel_op.h * Update kernel_op.h * Update kernel_dialect.h * Update kernel_factory.h * Update CMakeLists.txt * Update cf_dialect.h * Update control_flow_op.h * Update CMakeLists.txt
1 parent 1f03ab7 commit 9258294

File tree

7 files changed

+21
-24
lines changed

7 files changed

+21
-24
lines changed

paddle/fluid/pir/dialect/kernel/ir/kernel_dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace dialect {
2121

2222
class KernelDialect : public pir::Dialect {
2323
public:
24-
explicit KernelDialect(pir::IrContext* context);
24+
TEST_API explicit KernelDialect(pir::IrContext* context);
2525

2626
static const char* name() { return "pd_kernel"; }
2727

paddle/fluid/pir/dialect/kernel/ir/kernel_op.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class LegacyKernelOp : public pir::Op<LegacyKernelOp> {
3838
static const char *name() { return "pd_kernel.legacy_kernel"; }
3939
static constexpr uint32_t attributes_num = 3;
4040
static const char *attributes_name[attributes_num];
41-
std::string op_name();
42-
std::string kernel_name();
43-
phi::KernelKey kernel_key();
41+
TEST_API std::string op_name();
42+
TEST_API std::string kernel_name();
43+
TEST_API phi::KernelKey kernel_key();
4444
void VerifySig();
4545
};
4646

paddle/fluid/pir/dialect/operator/ir/control_flow_op.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class IfOp : public pir::Op<IfOp, VjpInterface> {
2929
static const char *name() { return "pd_op.if"; }
3030
static constexpr const char **attributes_name = nullptr;
3131
static constexpr uint32_t attributes_num = 0;
32-
static void Build(pir::Builder &builder, // NOLINT
33-
pir::OperationArgument &argument, // NOLINT
34-
pir::Value cond,
35-
std::vector<pir::Type> &&output_types);
32+
TEST_API static void Build(pir::Builder &builder, // NOLINT
33+
pir::OperationArgument &argument, // NOLINT
34+
pir::Value cond,
35+
std::vector<pir::Type> &&output_types);
3636

3737
static void Build(pir::Builder &builder, // NOLINT
3838
pir::OperationArgument &argument, // NOLINT

paddle/fluid/pir/transforms/pd_op_to_kernel_pass.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace dialect {
2121

2222
pir::Type ConvertOpTypeToKernelType(pir::Type op_type);
2323

24-
std::unique_ptr<pir::Program> PdOpLowerToKernelPass(
24+
TEST_API std::unique_ptr<pir::Program> PdOpLowerToKernelPass(
2525
pir::Program* prog, phi::Place place = phi::CPUPlace());
2626

2727
void ProcessBlock(

paddle/phi/core/kernel_factory.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class KernelKey {
8989
// Note: Now the number of bits we need does not exceed 32 bits, so there is
9090
// no need to use 64 bits. If needed in the future, it can be expanded,
9191
// but now we don’t over-design.
92-
uint32_t operator()(const KernelKey& key) const;
92+
TEST_API uint32_t operator()(const KernelKey& key) const;
9393
};
9494

9595
uint32_t hash_value() const { return Hash()(*this); }

paddle/pir/dialect/control_flow/ir/cf_dialect.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class ControlFlowDialect : public Dialect {
2424
initialize();
2525
}
2626
static const char *name() { return "cf"; }
27-
void PrintType(Type type, std::ostream &os) const override;
28-
void PrintOperation(Operation *op,
29-
IrPrinter &printer) const override; // NOLINT
27+
TEST_API void PrintType(Type type, std::ostream &os) const override;
28+
TEST_API void PrintOperation(Operation *op,
29+
IrPrinter &printer) const override; // NOLINT
3030
private:
31-
void initialize();
31+
TEST_API void initialize();
3232
};
3333

3434
} // namespace pir
+7-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
cc_test(
2-
ir_kernel_dialect_pass_test
3-
SRCS ir_kernel_dialect_pass_test.cc
4-
DEPS pir_transforms
5-
program_translator
6-
op_dialect
7-
pir
8-
phi
9-
common
10-
gtest)
1+
paddle_test(ir_kernel_dialect_pass_test SRCS ir_kernel_dialect_pass_test.cc)
2+
3+
if(WITH_ONNXRUNTIME AND WIN32)
4+
# Copy onnxruntime for some c++ test in Windows, since the test will
5+
# be build only in CI, so suppose the generator in Windows is Ninja.
6+
copy_onnx(ir_kernel_dialect_pass_test)
7+
endif()

0 commit comments

Comments
 (0)