Skip to content

Commit

Permalink
Don't bother trying tensor core support unless it's an NVIDIA GPU (le…
Browse files Browse the repository at this point in the history
…ela-zero#2422)

This is to try address leela-zero#2389 - strictly speaking this shouldn't be necessary
but this is to prevent any oddities
  • Loading branch information
ihavnoid authored Jul 27, 2019
1 parent 6fcd360 commit 730da82
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/OpenCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,21 @@ OpenCL<net_t>::OpenCL(int gpu, bool silent) {
}

myprintf("Tensor Core support: ");
try {
cl::Program(m_context, sourceCode_tensorcore_test).build(m_cl_args.c_str());
m_tensorcore = true;
myprintf("Yes.\n");
} catch (...) {
myprintf("No.\n");
{
// if this is a nvidia GPU, test-compile a sample inline assembly code with
// tensor wmma instructions. if not, don't bother trying
std::string this_vendor = m_device.getInfo<CL_DEVICE_VENDOR>();
if (boost::icontains(this_vendor, "nvidia")) {
try {
cl::Program(m_context, sourceCode_tensorcore_test).build(m_cl_args.c_str());
m_tensorcore = true;
myprintf("Yes.\n");
} catch (...) {
myprintf("No.\n");
}
} else {
myprintf("No.\n");
}
}
}

Expand Down

0 comments on commit 730da82

Please sign in to comment.