Skip to content

【paddle_test No.3】replace cc_test with paddle_test #60832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion paddle/fluid/pir/dialect/kernel/ir/kernel_dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace dialect {

class KernelDialect : public pir::Dialect {
public:
explicit KernelDialect(pir::IrContext* context);
TEST_API explicit KernelDialect(pir::IrContext* context);

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

Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/pir/dialect/kernel/ir/kernel_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class LegacyKernelOp : public pir::Op<LegacyKernelOp> {
static const char *name() { return "pd_kernel.legacy_kernel"; }
static constexpr uint32_t attributes_num = 3;
static const char *attributes_name[attributes_num];
std::string op_name();
std::string kernel_name();
phi::KernelKey kernel_key();
TEST_API std::string op_name();
TEST_API std::string kernel_name();
TEST_API phi::KernelKey kernel_key();
void VerifySig();
};

Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/pir/dialect/operator/ir/control_flow_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class IfOp : public pir::Op<IfOp, VjpInterface> {
static const char *name() { return "pd_op.if"; }
static constexpr const char **attributes_name = nullptr;
static constexpr uint32_t attributes_num = 0;
static void Build(pir::Builder &builder, // NOLINT
pir::OperationArgument &argument, // NOLINT
pir::Value cond,
std::vector<pir::Type> &&output_types);
TEST_API static void Build(pir::Builder &builder, // NOLINT
pir::OperationArgument &argument, // NOLINT
pir::Value cond,
std::vector<pir::Type> &&output_types);

static void Build(pir::Builder &builder, // NOLINT
pir::OperationArgument &argument, // NOLINT
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/pir/transforms/pd_op_to_kernel_pass.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace dialect {

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

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

void ProcessBlock(
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/core/kernel_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class KernelKey {
// Note: Now the number of bits we need does not exceed 32 bits, so there is
// no need to use 64 bits. If needed in the future, it can be expanded,
// but now we don’t over-design.
uint32_t operator()(const KernelKey& key) const;
TEST_API uint32_t operator()(const KernelKey& key) const;
};

uint32_t hash_value() const { return Hash()(*this); }
Expand Down
8 changes: 4 additions & 4 deletions paddle/pir/dialect/control_flow/ir/cf_dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class ControlFlowDialect : public Dialect {
initialize();
}
static const char *name() { return "cf"; }
void PrintType(Type type, std::ostream &os) const override;
void PrintOperation(Operation *op,
IrPrinter &printer) const override; // NOLINT
TEST_API void PrintType(Type type, std::ostream &os) const override;
TEST_API void PrintOperation(Operation *op,
IrPrinter &printer) const override; // NOLINT
private:
void initialize();
TEST_API void initialize();
};

} // namespace pir
Expand Down
17 changes: 7 additions & 10 deletions test/cpp/pir/kernel_dialect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
cc_test(
ir_kernel_dialect_pass_test
SRCS ir_kernel_dialect_pass_test.cc
DEPS pir_transforms
program_translator
op_dialect
pir
phi
common
gtest)
paddle_test(ir_kernel_dialect_pass_test SRCS ir_kernel_dialect_pass_test.cc)

if(WITH_ONNXRUNTIME AND WIN32)
# Copy onnxruntime for some c++ test in Windows, since the test will
# be build only in CI, so suppose the generator in Windows is Ninja.
copy_onnx(ir_kernel_dialect_pass_test)
endif()