Skip to content

Commit

Permalink
xe: jit: ir: fixup memory inefficiencies
Browse files Browse the repository at this point in the history
  • Loading branch information
atkassen committed Jan 17, 2025
1 parent 332c199 commit 29d8a22
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/gpu/intel/jit/ir/blocking.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2023-2024 Intel Corporation
* Copyright 2023-2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,7 +50,7 @@ class blocking_t {
return loop_.is_empty() && thread_group_.is_empty() && iter_.is_empty();
}
bool is_spatial() const {
for (auto d : {pvars::iw, pvars::ow}) {
for (const auto &d : {pvars::iw, pvars::ow}) {
if (iter_.has(d) && iter_[d] != 1) return true;
}
return false;
Expand Down
6 changes: 1 addition & 5 deletions src/gpu/intel/jit/ir/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ class exec_cfg_param_t : public value_param_t<exec_config_t> {
}

std::vector<std::string> accepted_keys() const override {
std::vector<std::string> ret;
ret.push_back("regs");
ret.push_back("simd");
ret.push_back("vec");
return ret;
return {"regs", "simd", "vec"};
}

void set_from_str(
Expand Down
11 changes: 6 additions & 5 deletions src/gpu/intel/jit/ir/gemm_schedule.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2021-2024 Intel Corporation
* Copyright 2021-2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -364,9 +364,9 @@ class loop_t {
oss << " kind: " << kind_;
if (unroll_factor_ != 1) oss << " unroll: " << unroll_factor_;
std::vector<std::string> props;
if (is_root()) props.push_back("root");
if (is_fused_child()) props.push_back("fused");
if (is_split_parent()) props.push_back("split");
if (is_root()) props.emplace_back("root");
if (is_fused_child()) props.emplace_back("fused");
if (is_split_parent()) props.emplace_back("split");
oss << "(" << make_seq_print_helper(props, ", ") << ")";
return oss.str();
}
Expand Down Expand Up @@ -623,8 +623,9 @@ class gemm_schedule_t {
}
auto &fused_loop = create_loop(fused_var, fused_bound);
std::vector<std::reference_wrapper<loop_t>> loop_refs;
loop_refs.reserve(vars.size());
for (auto &v : vars) {
loop_refs.push_back(find_loop(v));
loop_refs.emplace_back(find_loop(v));
}
fused_loop.set_fuse(loop_refs);
set_bmnk_kind(fused_var, bmnk_kind(vars));
Expand Down
2 changes: 2 additions & 0 deletions src/gpu/intel/jit/ir/ir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ struct expr_cast_helper_t {

static std::vector<T> call(const std::vector<expr_t> &exprs) {
std::vector<T> ret;
ret.reserve(exprs.size());
for (auto &e : exprs)
ret.push_back(to_cpp<T>(e));
return ret;
Expand All @@ -345,6 +346,7 @@ struct expr_cast_helper_t<expr_t> {
= typename std::enable_if<std::is_arithmetic<U>::value>::type>
static std::vector<expr_t> call(const std::vector<U> &vec) {
std::vector<expr_t> ret;
ret.reserve(vec.size());
for (auto &v : vec)
ret.push_back(to_expr(v));
return ret;
Expand Down
3 changes: 2 additions & 1 deletion src/gpu/intel/jit/ir/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ class layout_t {
b_str.append(1, '*');
}
}
ret = b_str + ret;
b_str += ret;
std::swap(ret, b_str);
dense_stride = b.stride * b.block;
seen[b.dim_idx] = true;
}
Expand Down

0 comments on commit 29d8a22

Please sign in to comment.