[FRONTEND] Added tl.clock
and tl.globaltimer
(#485)
This commit is contained in:
@@ -182,6 +182,8 @@ public:
|
||||
void visit_async_wait_inst(ir::async_wait_inst*);
|
||||
// void visit_make_range_dyn(ir::make_range_dyn*);
|
||||
void visit_make_range(ir::make_range*);
|
||||
void visit_clock_inst(ir::clock_inst*);
|
||||
void visit_globaltimer_inst(ir::globaltimer_inst*);
|
||||
// void visit_make_range_sta(ir::make_range_sta*);
|
||||
void visit_undef_value(ir::undef_value*);
|
||||
void visit_constant_int(ir::constant_int*);
|
||||
@@ -192,6 +194,7 @@ public:
|
||||
void visit_argument(ir::argument*);
|
||||
void visit(ir::module &, llvm::Module &);
|
||||
|
||||
|
||||
// layouts
|
||||
void visit_layout_mma(analysis::mma_layout*);
|
||||
void visit_layout_scanline(analysis::scanline_layout*);
|
||||
|
@@ -28,7 +28,9 @@ public:
|
||||
// Constructor
|
||||
builder(context &ctx);
|
||||
// Getters
|
||||
const context& get_context() { return ctx_; }
|
||||
// const context& get_context() const { return ctx_; }
|
||||
context& get_context() { return ctx_; }
|
||||
|
||||
// Setters
|
||||
void set_insert_point(iterator instr);
|
||||
void set_insert_point(instruction* i);
|
||||
|
@@ -101,6 +101,10 @@ struct dispatch{
|
||||
static ir::value *sin(ir::value *x, ir::builder *builder);
|
||||
static ir::value *sqrt(ir::value *x, ir::builder *builder);
|
||||
|
||||
// utilities
|
||||
static ir::value *globaltimer(ir::builder *builder);
|
||||
static ir::value *clock(ir::builder *builder);
|
||||
|
||||
// internal (debug/optimization)
|
||||
static ir::value *multiple_of(ir::value *x, int value, ir::builder *builder);
|
||||
static ir::value *max_contiguous(ir::value *x, int value, ir::builder *builder);
|
||||
|
@@ -165,6 +165,8 @@ enum value_id_t: unsigned {
|
||||
INST_MAKE_RANGE_STA,
|
||||
INST_MAKE_RANGE,
|
||||
INST_PREFETCH_S,
|
||||
INST_GLOBALTIMER,
|
||||
INST_CLOCK,
|
||||
};
|
||||
|
||||
|
||||
|
@@ -971,6 +971,27 @@ private:
|
||||
constant_int* last_;
|
||||
};
|
||||
|
||||
/* timing utilities */
|
||||
class clock_inst: public instruction{
|
||||
clock_inst(context &ctx, const std::string &name, instruction *next);
|
||||
std::string repr_impl() const { return "clock"; }
|
||||
_TRITON_DEFINE_CLONE(clock_inst)
|
||||
_TRITON_DEFINE_ACCEPT(clock_inst)
|
||||
|
||||
public:
|
||||
static clock_inst* create(context &ctx, const std::string &name = "", instruction *next = nullptr);
|
||||
};
|
||||
|
||||
class globaltimer_inst: public instruction{
|
||||
globaltimer_inst(context &ctx, const std::string &name, instruction *next);
|
||||
std::string repr_impl() const { return "globaltimer"; }
|
||||
_TRITON_DEFINE_CLONE(globaltimer_inst)
|
||||
_TRITON_DEFINE_ACCEPT(globaltimer_inst)
|
||||
|
||||
public:
|
||||
static globaltimer_inst* create(context &ctx, const std::string &name = "", instruction *next = nullptr);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -75,6 +75,8 @@ class async_wait_inst;
|
||||
class make_range_dyn;
|
||||
class make_range;
|
||||
class prefetch_s_inst;
|
||||
class clock_inst;
|
||||
class globaltimer_inst;
|
||||
|
||||
class make_range_sta;
|
||||
class undef_value;
|
||||
@@ -157,6 +159,8 @@ public:
|
||||
virtual void visit_make_range(make_range*) = 0;
|
||||
virtual void visit_prefetch_s_inst(prefetch_s_inst*) = 0;
|
||||
virtual void visit_function(function*) = 0;
|
||||
virtual void visit_clock_inst(clock_inst*) = 0;
|
||||
virtual void visit_globaltimer_inst(globaltimer_inst*) = 0;
|
||||
|
||||
virtual void visit_undef_value(undef_value*) = 0;
|
||||
virtual void visit_constant_int(constant_int*) = 0;
|
||||
|
Reference in New Issue
Block a user