FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adjust JIT heuristics for the Intel GPU on the OpenCL backend by umar456 · Pull Request #2855 · arrayfire/arrayfire · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (2) .hpp  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 15 additions & 1 deletion src/backend/opencl/Array.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,16 @@ kJITHeuristics passesJitHeuristics(Node *root_node) {
platform == AFCL_PLATFORM_NVIDIA || platform == AFCL_PLATFORM_APPLE;
bool isAmd =
platform == AFCL_PLATFORM_AMD || platform == AFCL_PLATFORM_APPLE;
bool isIntel = platform == AFCL_PLATFORM_INTEL;

/// Intels param_size limit is much smaller than the other platforms
/// so we need to start checking earlier with smaller trees
int heightCheckLimit =
isIntel && getDeviceType() == CL_DEVICE_TYPE_GPU ? 3 : 6;

// A lightweight check based on the height of the node. This is
// an inexpensive operation and does not traverse the JIT tree.
bool isParamLimit = (root_node->getHeight() > 6);
bool isParamLimit = (root_node->getHeight() >= heightCheckLimit);
if (isParamLimit || isBufferLimit) {
// This is the base parameter size if the kernel had no
// arguments
Expand All @@ -317,11 +323,19 @@ kJITHeuristics passesJitHeuristics(Node *root_node) {
constexpr size_t max_nvidia_param_size = (4096 - base_param_size);
constexpr size_t max_amd_param_size = (3520 - base_param_size);

// This value is really for the Intel HD Graphics platform. The CPU
// platform seems like it can handle unlimited parameters but the
// compile times become very large.
constexpr size_t max_intel_igpu_param_size =
(1024 - 256 - base_param_size);

size_t max_param_size = 0;
if (isNvidia) {
max_param_size = max_nvidia_param_size;
} else if (isAmd) {
max_param_size = max_amd_param_size;
} else if (isIntel && getDeviceType() == CL_DEVICE_TYPE_GPU) {
max_param_size = max_intel_igpu_param_size;
} else {
max_param_size = 8192;
}
Expand Down
4 changes: 1 addition & 3 deletions src/backend/opencl/binary.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
namespace opencl {

template<typename To, typename Ti, af_op_t op>
struct BinOp {
const char *name() { return "__invalid"; }
};
struct BinOp;

#define BINARY_TYPE_1(fn) \
template<typename To, typename Ti> \
Expand Down
11 changes: 11 additions & 0 deletions src/backend/opencl/platform.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,24 @@ static inline string& ltrim(string& s) {
return s;
}

bool verify_present(const std::string& pname, const std::string ref) {
auto iter = std::search(
begin(pname), end(pname), std::begin(ref), std::end(ref),
[](const std::string::value_type& l, const std::string::value_type& r) {
return tolower(l) == tolower(r);
});

return iter != end(pname);
}

static string platformMap(string& platStr) {
using strmap_t = map<string, string>;
static const strmap_t platMap = {
make_pair("NVIDIA CUDA", "NVIDIA"),
make_pair("Intel(R) OpenCL", "INTEL"),
make_pair("AMD Accelerated Parallel Processing", "AMD"),
make_pair("Intel Gen OCL Driver", "BEIGNET"),
make_pair("Intel(R) OpenCL HD Graphics", "INTEL"),
make_pair("Apple", "APPLE"),
make_pair("Portable Computing Language", "POCL"),
};
Expand Down
4 changes: 1 addition & 3 deletions src/backend/opencl/platform.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ class GraphicsResourceManager;
struct kc_entry_t; // kernel cache entry
class PlanCache; // clfft

static inline bool verify_present(std::string pname, const char* ref) {
return pname.find(ref) != std::string::npos;
}
bool verify_present(const std::string& pname, const std::string ref);

int getBackend();

Expand Down

Back | FazBrowse Home | New Git URL