Skip to content

Commit 96709ab

Browse files
authored
Revert "[compilation opt]Change cc test old (#60307)"
This reverts commit 887ef4a.
1 parent 2dfa0f7 commit 96709ab

11 files changed

Lines changed: 207 additions & 43 deletions

File tree

paddle/fluid/pir/dialect/op_generator/op_gen.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939
)
4040
import gen as vjp_gen
4141

42-
# Note(Galaxy1458) The need_export_symbol_op_list is used
43-
# for some unittests these need to export symbol op compiled with dynamic lib.
44-
need_export_symbol_op_list = ['AbsOp', 'FullOp']
45-
4642
# =====================================
4743
# String Template for h file code gen
4844
# =====================================
@@ -93,7 +89,7 @@
9389
"""
9490

9591
OP_DECLARE_TEMPLATE = """
96-
class {TEST_API} {op_name} : public pir::Op<{op_name}{interfaces}{traits}> {{
92+
class {op_name} : public pir::Op<{op_name}{interfaces}{traits}> {{
9793
public:
9894
using Op::Op;
9995
static const char *name() {{ return "{dialect_op_name}"; }}
@@ -1355,12 +1351,8 @@ def AutoCodeGen(op_info_items, all_op_info_items, namespaces, dialect_name):
13551351
)
13561352

13571353
# gen op_declare_str/op_defined_str
1358-
TEST_API = ""
1359-
if op_class_name in need_export_symbol_op_list:
1360-
TEST_API = "TEST_API"
13611354
if len(op_non_mutable_attribute_name_list) == 0:
13621355
op_declare_str = OP_DECLARE_TEMPLATE.format(
1363-
TEST_API=TEST_API,
13641356
op_name=op_class_name,
13651357
dialect_op_name=op_dialect_name,
13661358
interfaces=op_interfaces_str,
@@ -1380,7 +1372,6 @@ def AutoCodeGen(op_info_items, all_op_info_items, namespaces, dialect_name):
13801372
op_defined_str = ""
13811373
else:
13821374
op_declare_str = OP_DECLARE_TEMPLATE.format(
1383-
TEST_API=TEST_API,
13841375
op_name=op_class_name,
13851376
dialect_op_name=op_dialect_name,
13861377
interfaces=op_interfaces_str,

paddle/phi/common/data_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ using bfloat16 = ::phi::dtype::bfloat16;
3535
using pstring = ::phi::dtype::pstring;
3636

3737
// The enum value are consistent with jit/property.proto
38-
enum class TEST_API DataType {
38+
enum class DataType {
3939
UNDEFINED = 0,
4040

4141
BOOL,

paddle/phi/common/int_array.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ template <typename T>
3232
class IntArrayBase {
3333
public:
3434
// Constructor support implicit
35-
TEST_API IntArrayBase() = default;
35+
IntArrayBase() = default;
3636

3737
IntArrayBase(const std::vector<int64_t>& vec) : array_(vec) {} // NOLINT
3838

@@ -58,13 +58,12 @@ class IntArrayBase {
5858
explicit IntArrayBase(const common::DDim& dims);
5959

6060
// The Tensor must have one dim
61-
TEST_API IntArrayBase(const T& tensor); // NOLINT
61+
IntArrayBase(const T& tensor); // NOLINT
6262

6363
// The Tensor in vec must have only one element
64-
TEST_API IntArrayBase(const std::vector<T>& tensor_list); // NOLINT
64+
IntArrayBase(const std::vector<T>& tensor_list); // NOLINT
6565

66-
TEST_API explicit IntArrayBase(
67-
const std::vector<phi::TensorRef>& tensor_ref_list);
66+
explicit IntArrayBase(const std::vector<phi::TensorRef>& tensor_ref_list);
6867

6968
template <typename OtherT>
7069
IntArrayBase(const IntArrayBase<OtherT>& other) : array_(other.GetData()) {}

paddle/phi/core/infermeta_utils.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ template const std::vector<std::string>& InferMetaContext::AttrAt(
153153
template const Scalar& InferMetaContext::AttrAt(size_t idx) const;
154154
template const std::vector<Scalar>& InferMetaContext::AttrAt(size_t idx) const;
155155
template const IntArray& InferMetaContext::AttrAt(size_t idx) const;
156-
template TEST_API const DataType& InferMetaContext::AttrAt(size_t idx) const;
156+
template const DataType& InferMetaContext::AttrAt(size_t idx) const;
157157
template const DataLayout& InferMetaContext::AttrAt(size_t idx) const;
158158
template const Place& InferMetaContext::AttrAt(size_t idx) const;
159159
template const TensorRef& InferMetaContext::AttrAt(size_t idx) const;

paddle/phi/core/infermeta_utils.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,32 @@ class InferMetaContext {
4141
const MetaConfig& GetMetaConfig() const;
4242

4343
void EmplaceBackInput(MetaTensor input);
44-
TEST_API void EmplaceBackOutput(MetaTensor output);
45-
TEST_API void EmplaceBackAttr(Attribute attr);
44+
void EmplaceBackOutput(MetaTensor output);
45+
void EmplaceBackAttr(Attribute attr);
4646

4747
void EmplaceBackInputs(
4848
paddle::small_vector<MetaTensor, phi::kInputSmallVectorSize> inputs);
4949
void EmplaceBackOutputs(
5050
paddle::small_vector<MetaTensor, phi::kOutputSmallVectorSize> outputs);
5151

52-
TEST_API virtual const MetaTensor& InputAt(size_t idx) const;
52+
virtual const MetaTensor& InputAt(size_t idx) const;
5353

54-
TEST_API virtual std::vector<const MetaTensor*> InputsBetween(
55-
size_t start, size_t end) const;
56-
TEST_API virtual paddle::optional<std::vector<const MetaTensor*>>
54+
virtual std::vector<const MetaTensor*> InputsBetween(size_t start,
55+
size_t end) const;
56+
virtual paddle::optional<std::vector<const MetaTensor*>>
5757
OptionalInputsBetween(size_t start, size_t end) const;
5858

59-
TEST_API virtual MetaTensor* MutableOutputAt(size_t idx);
60-
TEST_API virtual std::vector<MetaTensor*> MutableOutputBetween(size_t start,
61-
size_t end);
59+
virtual MetaTensor* MutableOutputAt(size_t idx);
60+
virtual std::vector<MetaTensor*> MutableOutputBetween(size_t start,
61+
size_t end);
6262

6363
template <typename AttrType>
64-
TEST_API const AttrType& AttrAt(size_t idx) const;
64+
const AttrType& AttrAt(size_t idx) const;
6565

66-
TEST_API const Attribute& AttrAt(size_t idx) const;
66+
const Attribute& AttrAt(size_t idx) const;
6767

6868
const std::pair<int, int>& InputRangeAt(size_t idx) const;
69-
TEST_API const std::pair<int, int>& OutputRangeAt(size_t idx) const;
69+
const std::pair<int, int>& OutputRangeAt(size_t idx) const;
7070

7171
virtual ~InferMetaContext() = default;
7272

paddle/phi/core/meta_tensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct MetaConfig {
3434
is_run_mkldnn_kernel(is_run_mkldnn_kernel) {} // NOLINT
3535
};
3636

37-
class TEST_API MetaTensor {
37+
class MetaTensor {
3838
public:
3939
typedef void (*unspecified_bool_type)();
4040

paddle/phi/infermeta/binary.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ void DropoutNdInferMeta(const MetaTensor& x,
221221
MetaTensor* out,
222222
MetaTensor* mask);
223223

224-
TEST_API void ElementwiseInferMeta(const MetaTensor& x,
225-
const MetaTensor& y,
226-
MetaTensor* out);
224+
void ElementwiseInferMeta(const MetaTensor& x,
225+
const MetaTensor& y,
226+
MetaTensor* out);
227227

228228
void ElementwiseRawInferMeta(const MetaTensor& x_meta,
229229
const MetaTensor& y_meta,

paddle/phi/infermeta/nullary.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ void CreateVecShapeInferMeta(const std::vector<int64_t>& shape,
4848

4949
void CreateArrayInferMeta(DataType dtype, MetaTensor* out);
5050

51-
TEST_API void CreateInferMeta(const IntArray& shape,
52-
DataType dtype,
53-
MetaTensor* out);
51+
void CreateInferMeta(const IntArray& shape, DataType dtype, MetaTensor* out);
5452

5553
void CreateInferMetaBase(const std::vector<int64_t>& shape,
5654
DataType dtype,

paddle/phi/kernels/elementwise_add_kernel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
namespace phi {
2121
template <typename T, typename Context>
22-
TEST_API void AddKernel(const Context& dev_ctx,
23-
const DenseTensor& x,
24-
const DenseTensor& y,
25-
DenseTensor* out);
22+
void AddKernel(const Context& dev_ctx,
23+
const DenseTensor& x,
24+
const DenseTensor& y,
25+
DenseTensor* out);
2626

2727
template <typename T, typename Context>
2828
DenseTensor Add(const Context& dev_ctx,

test/cpp/pir/core/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@ paddle_test(ir_value_test SRCS ir_value_test.cc)
44
paddle_test(ir_op_test SRCS ir_op_test.cc DEPS test_dialect)
55
paddle_test(ir_region_test SRCS ir_region_test.cc)
66
paddle_test(ir_builder_test SRCS ir_builder_test.cc)
7-
paddle_test(ir_program_test SRCS ir_program_test.cc)
8-
paddle_test(ir_infershape_test SRCS ir_infershape_test.cc)
9-
paddle_test(scalar_attribute_test SRCS scalar_attribute_test.cc)
7+
cc_test_old(
8+
ir_program_test
9+
SRCS
10+
ir_program_test.cc
11+
DEPS
12+
common
13+
gtest
14+
pir
15+
op_dialect_vjp
16+
phi)
17+
18+
cc_test_old(ir_infershape_test SRCS ir_infershape_test.cc DEPS common gtest)
19+
20+
cc_test_old(scalar_attribute_test SRCS scalar_attribute_test.cc DEPS gtest)
1021

1122
file(
1223
DOWNLOAD https://paddle-ci.gz.bcebos.com/ir_translator_test/resnet50_main.prog

0 commit comments

Comments
 (0)