File tree Expand file tree Collapse file tree 9 files changed +18
-18
lines changed
paddle/fluid/operators/jit Expand file tree Collapse file tree 9 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ class VActFunc : public JitCode {
63
63
public:
64
64
explicit VActFunc (size_t code_size, void * code_ptr)
65
65
: JitCode(code_size, code_ptr) {}
66
- virtual const char * name () const = 0;
67
66
virtual void genCode () = 0;
68
67
69
68
protected:
@@ -269,7 +268,7 @@ class VActJitCode : public VActFunc {
269
268
this ->genCode ();
270
269
}
271
270
272
- const char * name () const override {
271
+ std::string name () const override {
273
272
std::string base = " VActJitCode" ;
274
273
switch (type_) {
275
274
case operand_type::RELU:
@@ -293,7 +292,7 @@ class VActJitCode : public VActFunc {
293
292
default :
294
293
break ;
295
294
}
296
- return base. c_str () ;
295
+ return base;
297
296
}
298
297
void genCode () override ;
299
298
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class VXXJitCode : public JitCode {
41
41
this ->genCode ();
42
42
}
43
43
44
- virtual const char * name () const {
44
+ std::string name () const override {
45
45
std::string base = " VXXJitCode" ;
46
46
if (scalar_index_ == 1 ) {
47
47
base += " _Scalar" ;
@@ -62,7 +62,7 @@ class VXXJitCode : public JitCode {
62
62
}
63
63
base += (with_relu_ ? " _Relu" : " " );
64
64
base += " _D" + std::to_string (num_);
65
- return base. c_str () ;
65
+ return base;
66
66
}
67
67
void genCode () override ;
68
68
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class GRUJitCode : public VActFunc {
49
49
this ->genCode ();
50
50
}
51
51
52
- const char * name () const override {
52
+ std::string name () const override {
53
53
std::string base = " GRUJitCode" ;
54
54
if (id_ == 0 ) {
55
55
base += " _H1" ;
@@ -81,7 +81,7 @@ class GRUJitCode : public VActFunc {
81
81
};
82
82
AddTypeStr (act_gate_);
83
83
AddTypeStr (act_cand_);
84
- return base. c_str () ;
84
+ return base;
85
85
}
86
86
void genCode () override ;
87
87
Original file line number Diff line number Diff line change @@ -35,14 +35,14 @@ class HOPVJitCode : public JitCode {
35
35
this ->genCode ();
36
36
}
37
37
38
- virtual const char * name () const {
38
+ std::string name () const override {
39
39
std::string base = " VXXJitCode" ;
40
40
if (type_ == operand_type::MAX) {
41
41
base += " _MAX" ;
42
42
} else {
43
43
base += " _SUM" ;
44
44
}
45
- return base. c_str () ;
45
+ return base;
46
46
}
47
47
void genCode () override ;
48
48
Original file line number Diff line number Diff line change 14
14
15
15
#pragma once
16
16
17
+ #include < string>
17
18
#include < type_traits>
18
19
#include " paddle/fluid/operators/jit/gen_base.h"
19
20
#include " paddle/fluid/platform/cpu_info.h"
@@ -59,7 +60,7 @@ typedef enum {
59
60
} operand_type;
60
61
61
62
#define DECLARE_JIT_CODE (codename ) \
62
- const char * name () const override { return #codename; }
63
+ std::string name () const override { return #codename; }
63
64
64
65
class JitCode : public GenBase , public Xbyak ::CodeGenerator {
65
66
public:
@@ -68,7 +69,6 @@ class JitCode : public GenBase, public Xbyak::CodeGenerator {
68
69
(code_size % 4096 != 0 ? (code_size / 4096 + 1 ) * 4096 : code_size),
69
70
code_ptr) {}
70
71
71
- virtual const char * name () const = 0;
72
72
virtual void genCode () = 0;
73
73
74
74
size_t getSize () const override { return CodeGenerator::getSize (); }
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ class LSTMJitCode : public VActFunc {
53
53
this ->genCode ();
54
54
}
55
55
56
- const char * name () const override {
56
+ std::string name () const override {
57
57
std::string base = " LSTMJitCode" ;
58
58
if (use_peephole_) {
59
59
base += " _Peephole" ;
@@ -85,7 +85,7 @@ class LSTMJitCode : public VActFunc {
85
85
AddTypeStr (act_gate_);
86
86
AddTypeStr (act_cand_);
87
87
AddTypeStr (act_cell_);
88
- return base. c_str () ;
88
+ return base;
89
89
}
90
90
void genCode () override ;
91
91
Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ class MatMulJitCode : public JitCode {
36
36
this ->genCode ();
37
37
}
38
38
39
- virtual const char * name () const {
39
+ std::string name () const override {
40
40
std::string base = " MatMulJitCode" ;
41
41
base = base + " _M" + std::to_string (m_) + " _N" + std::to_string (n_) + " _K" +
42
42
std::to_string (k_);
43
- return base. c_str () ;
43
+ return base;
44
44
}
45
45
void genCode () override ;
46
46
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class SeqPoolJitCode : public JitCode {
38
38
this ->genCode ();
39
39
}
40
40
41
- virtual const char * name () const {
41
+ std::string name () const override {
42
42
std::string base = " SeqPoolJitCode" ;
43
43
if (type_ == SeqPoolType::kSum ) {
44
44
base += " _Sum" ;
@@ -48,7 +48,7 @@ class SeqPoolJitCode : public JitCode {
48
48
base += " _Sqrt" ;
49
49
}
50
50
base += (" _W" + std::to_string (w_));
51
- return base. c_str () ;
51
+ return base;
52
52
}
53
53
void genCode () override ;
54
54
Original file line number Diff line number Diff line change 16
16
17
17
#include < gflags/gflags.h>
18
18
#include < memory> // for unique_ptr
19
+ #include < string>
19
20
#include < vector>
20
21
#include " paddle/fluid/operators/jit/kernel_base.h"
21
22
@@ -28,7 +29,7 @@ namespace jit {
28
29
class GenBase : public Kernel {
29
30
public:
30
31
virtual ~GenBase () = default ;
31
- virtual const char * name () const = 0;
32
+ virtual std::string name () const = 0;
32
33
virtual size_t getSize () const = 0;
33
34
virtual const unsigned char * getCodeInternal () = 0;
34
35
template <typename Func>
You can’t perform that action at this time.
0 commit comments