Skip to content

Commit

Permalink
xe: reduce dependencies from jit/utils/utils.hpp header
Browse files Browse the repository at this point in the history
  • Loading branch information
echeresh committed Aug 2, 2024
1 parent b7d18cc commit 89dea2a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 8 deletions.
40 changes: 40 additions & 0 deletions src/gpu/intel/jit/jit_generator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright 2024 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/

#include "gpu/intel/jit/jit_generator.hpp"

#include "gpu/intel/jit/utils/utils.hpp"

namespace dnnl {
namespace impl {
namespace gpu {
namespace intel {
namespace jit {

void check_kernel_size(const std::string &kernel_name, size_t kernel_size,
size_t icache_size) {
if (kernel_size > icache_size) {
ir_warning() << kernel_name
<< " larger than icache, kernel: " << kernel_size
<< " bytes, icache: " << icache_size << " bytes\n";
}
}

} // namespace jit
} // namespace intel
} // namespace gpu
} // namespace impl
} // namespace dnnl
13 changes: 5 additions & 8 deletions src/gpu/intel/jit/jit_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "gpu/intel/jit/emulation.hpp"
#include "gpu/intel/jit/jit_generator_base.hpp"
#include "gpu/intel/jit/utils/ngen_type_bridge.hpp"
#include "gpu/intel/jit/utils/utils.hpp"
#include "xpu/utils.hpp"

#include "gpu/intel/jit/ngen/ngen_opencl.hpp"
Expand Down Expand Up @@ -171,18 +170,16 @@ void jit_generator<hw>::dbg_alloc(cl_context context) {
}
#endif

void check_kernel_size(
const std::string &kernel_name, size_t kernel_size, size_t icache_size);

template <template <ngen::HW> class KernelT, ngen::HW arch, typename... ArgsT>
std::unique_ptr<jit::jit_generator_base> make_generator(
const compute::device_info_t &device_info, ArgsT &&...args) {

auto raw_kernel = new KernelT<arch>(std::forward<ArgsT>(args)...);
if (raw_kernel->getRootStreamLength() > device_info.icache_size()) {
ir_warning() << raw_kernel->kernel_name()
<< " larger than icache, kernel: "
<< raw_kernel->getRootStreamLength()
<< " bytes, icache: " << device_info.icache_size()
<< " bytes\n";
}
check_kernel_size(raw_kernel->kernel_name(),
raw_kernel->getRootStreamLength(), device_info.icache_size());
return std::unique_ptr<jit::jit_generator_base>(raw_kernel);
}

Expand Down

0 comments on commit 89dea2a

Please sign in to comment.