Skip to content

xe: jit: enable lazy signal header allocation #3402

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/gpu/intel/jit/codegen/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class ir_to_ngen_t : public ir_visitor_t {
ngen::InstructionModifier mod;
if (!attr.is_empty())
mod = mod | to_ngen(attr.as<instruction_modifier_attr_t>().mod);
host_->barriermsg(mod, host_->signal_header_);
host_->barriermsg(mod, host_->signal_header());
}

void barrier_wait() { host_->barrierwait(); }
Expand All @@ -484,7 +484,7 @@ class ir_to_ngen_t : public ir_visitor_t {

host_->slmfence(mod, tmp, host_->r0);
host_->fencewait();
host_->barriermsg(mod, host_->signal_header_);
host_->barriermsg(mod, host_->signal_header());
host_->barrierwait();
}

Expand Down
11 changes: 5 additions & 6 deletions src/gpu/intel/jit/codegen/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ class ir_kernel_base_t : public ngen_generator_t {
}
// Enable IEEE f32 -> s32 rounding and f64/f32/f16 denormals.
or_(1, ngen_generator_t::cr0, ngen_generator_t::cr0, uint16_t(0x14C0));

// Allocate and initialize signal header for future use.
if (exec_cfg_.require_signal_header()) {
signal_header_ = ra_.alloc();
ngen_generator_t::barrierheader(signal_header_);
}
}

void bind_external_vars(
Expand Down Expand Up @@ -430,6 +424,11 @@ class ir_kernel_base_t : public ngen_generator_t {
nop();
}

const ngen::GRF &signal_header() {
if (signal_header_.isInvalid()) { signal_header_ = ra_.alloc(); }
return signal_header_;
}

void emov(const ngen::InstructionModifier &mod, const ngen_operand_t &dst,
const ngen_operand_t &src0) {
if (dst.is_reg_data()) {
Expand Down
1 change: 0 additions & 1 deletion src/gpu/intel/jit/conv/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,6 @@ status_t init_pd_time_cfg(const conv_problem_t &prb, conv_config_t &cfg,
cfg.set_exec_cfg(exec_config_t(hw));
cfg.maybe_override_from_env();

cfg.set_require_signal_header(true);
CHECK(init_fma_kind(cfg, pd, engine));
CHECK(init_simd(cfg));
CHECK(init_vec_size(cfg));
Expand Down
6 changes: 0 additions & 6 deletions src/gpu/intel/jit/conv/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,12 +599,6 @@ class conv_config_t : public prim_config_t {
set_exec_cfg(tmp);
}

void set_require_signal_header(bool r) {
auto tmp = exec_cfg();
tmp.set_require_signal_header(r);
set_exec_cfg(tmp);
}

void set_tiler(const std::shared_ptr<conv_tiler_t> &tiler);
const conv_tiler_t &tiler() const;
conv_tiler_t &tiler();
Expand Down
11 changes: 2 additions & 9 deletions src/gpu/intel/jit/ir/hw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,17 @@ class exec_config_t {
public:
exec_config_t() = default;
exec_config_t(const hw_t &hw) : hw_(hw) {}
exec_config_t(const hw_t &hw, int regs, int simd,
bool require_signal_header = false)
: hw_(hw)
, regs_(regs)
, simd_(simd)
, require_signal_header_(require_signal_header) {}
exec_config_t(const hw_t &hw, int regs, int simd)
: hw_(hw), regs_(regs), simd_(simd) {}

const hw_t &hw() const { return hw_; }
int regs() const { return regs_; }
int simd() const { return simd_; }
int vec_size() const { return vec_size_; }
int grf_size() const { return hw_.grf_size(); }
bool require_signal_header() const { return require_signal_header_; }
void set_regs(int regs) { regs_ = regs; }
void set_simd(int simd) { simd_ = simd; }
void set_vec_size(int vec_size) { vec_size_ = vec_size; }
void set_require_signal_header(bool r) { require_signal_header_ = r; }

std::string str() const {
std::ostringstream oss;
Expand All @@ -178,7 +172,6 @@ class exec_config_t {
int regs_ = 0;
int simd_ = 0;
int vec_size_ = 0;
bool require_signal_header_ = false;
};

} // namespace jit
Expand Down
2 changes: 1 addition & 1 deletion src/gpu/intel/jit/v2/conv/kernel_desc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class kernel_desc_t : public kernel_desc_base_t {
std::string kernel_name() const override { return "gen_conv_v2"; }

exec_config_t exec_cfg(const impl::engine_t *engine) const override {
return exec_config_t(hw_t(engine), regs, simd, true);
return exec_config_t(hw_t(engine), regs, simd);
}

compute::range_t local_range() const override;
Expand Down