Skip to content
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

[TOPI] Conv2d Added and Optimized for Intel HD Graphics #1290

Merged
merged 23 commits into from
Jun 22, 2018
Merged
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
6 changes: 3 additions & 3 deletions include/tvm/build_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ EXPORT Target rasp(const std::vector<std::string>& options =
EXPORT Target mali(const std::vector<std::string>& options =
std::vector<std::string>());

/*! \return A target for Intel GPU */
EXPORT Target intel_gpu(const std::vector<std::string>& options =
std::vector<std::string>());
/*! \return A target for Intel Graphics */
EXPORT Target intel_graphics(const std::vector<std::string>& options =
std::vector<std::string>());

/*! \return A target for stackvm */
EXPORT Target stackvm(const std::vector<std::string>& options =
Expand Down
8 changes: 4 additions & 4 deletions python/tvm/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Target(NodeBase):
- :any:`tvm.target.cuda` create CUDA target
- :any:`tvm.target.rocm` create ROCM target
- :any:`tvm.target.mali` create Mali target
- :any:`tvm.target.intel_gpu` create Intel GPU target
- :any:`tvm.target.intel_graphics` create Intel Graphics target
"""
def __init__(self, handle):
super(Target, self).__init__(handle)
Expand Down Expand Up @@ -402,15 +402,15 @@ def mali(options=None):
return _api_internal._TargetCreate("opencl", *opts)


def intel_gpu(options=None):
"""Returns an Intel GPU target.
def intel_graphics(options=None):
"""Returns an Intel Graphics target.

Parameters
----------
options : str or list of str
Additional options
"""
opts = ["-device=intel_gpu"]
opts = ["-device=intel_graphics"]
opts = _merge_opts(opts, options)
return _api_internal._TargetCreate("opencl", *opts)

Expand Down
6 changes: 3 additions & 3 deletions src/codegen/build_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Target CreateTarget(const std::string& target_name,
t->keys_array.push_back(ir::StringImm::make("rocm"));
t->keys_array.push_back(ir::StringImm::make("gpu"));
t->max_num_threads = 256;
if (t->device_name == "intel_gpu") {
if (t->device_name == "intel_graphics") {
t->thread_warp_size = 16;
}
} else if (target_name == "metal" || target_name == "vulkan") {
Expand Down Expand Up @@ -274,9 +274,9 @@ Target mali(const std::vector<std::string>& options) {
}));
}

Target intel_gpu(const std::vector<std::string>& options) {
Target intel_graphics(const std::vector<std::string>& options) {
return CreateTarget("opencl", MergeOptions(options, {
"-device=intel_gpu"
"-device=intel_graphics"
}));
}

Expand Down
2 changes: 1 addition & 1 deletion src/codegen/codegen_opencl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void CodeGenOpenCL::PrintStorageSync(const Call* op) {
const std::string& sync = op->args[0].as<StringImm>()->value;
if (sync == "warp") {
this->PrintIndent();
this->stream << "sub_group_barrier(CLK_LOCAL_MEM_FENCE);\n";
this->stream << "barrier(CLK_LOCAL_MEM_FENCE);\n";
} else if (sync == "shared") {
this->PrintIndent();
this->stream << "barrier(CLK_LOCAL_MEM_FENCE);\n";
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/opencl/opencl_device_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void OpenCLWorkspace::GetAttr(
}
case kWarpSize: {
/* TODO: the warp size of OpenCL device is not always 1
e.g. Intel GPU has a sub group concept which contains 8 - 32 work items,
e.g. Intel Graphics has a sub group concept which contains 8 - 32 work items,
corresponding to the number of SIMD entries the heardware configures.
We need to figure out a way to query this information from the hardware.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/python/integration/test_ewise.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def check_device(device, host="stackvm"):
np.testing.assert_allclose(
b.asnumpy(), np.exp(a.asnumpy()), rtol=1e-5)

check_device("opencl -device=intel_gpu")
check_device("opencl -device=intel_graphics")
check_device("cuda", "llvm")
check_device("vulkan")

Expand Down
2 changes: 1 addition & 1 deletion tests/python/unittest/test_lang_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_target_string_parse():
assert str(target) == str(tvm.target.cuda("-libs=cublas,cudnn"))


assert tvm.target.intel_gpu().device_name == "intel_gpu"
assert tvm.target.intel_graphics().device_name == "intel_graphics"

if __name__ == "__main__":
test_target_dispatch()
Expand Down
1 change: 1 addition & 0 deletions topi/python/topi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from . import cuda
from . import rasp
from . import mali
from . import intel_graphics
from . import opengl
from . import util
from . import rocm
Expand Down
5 changes: 2 additions & 3 deletions topi/python/topi/cuda/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def _schedule(Pool):
else:
Out = outs[0].op.output(0)
s[Pool].set_scope("local")
i, c, h, w = s[Out].op.axis
by, ty = s[Out].split(i, factor=num_thread)
bx, tx = s[Out].split(c, factor=num_thread)
by, ty = s[Out].split(s[Out].op.axis[0], factor=num_thread)
bx, tx = s[Out].split(s[Out].op.axis[1], factor=num_thread)
s[Out].reorder(by, bx, ty, tx)
s[Out].bind(ty, thread_y)
s[Out].bind(tx, thread_x)
Expand Down
5 changes: 5 additions & 0 deletions topi/python/topi/intel_graphics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pylint: disable=redefined-builtin, wildcard-import
"""Intel Gen9 GPU specific declaration and schedules."""
from __future__ import absolute_import as _abs

from .conv2d import *
Loading