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

Resolve opencl cache creation fail in base_aaos #16

Draft
wants to merge 1 commit into
base: celadon/u/mr0/master
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ cc_defaults {

shared_libs: [
"libgmm_umd",
"libcutils",
"liblog",
],

static_libs: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
Expand All @@ -13,9 +13,13 @@
#include "shared/source/utilities/io_functions.h"

#include "os_inc.h"
#include <android/log.h>

#include <dlfcn.h>
#include <link.h>
#include <string>
#define LOG_TAG "COMPUTE_RUNTIME"
#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

namespace NEO {
int64_t defaultCacheEnabled() {
Expand Down Expand Up @@ -47,26 +51,40 @@ bool createCompilerCachePath(std::string &cacheDir) {
bool checkDefaultCacheDirSettings(std::string &cacheDir, NEO::EnvironmentVariableReader &reader) {
std::string emptyString = "";
cacheDir = reader.getSetting("XDG_CACHE_HOME", emptyString);
#ifdef ANDROID
ALOGE("Ratne1: %s: CacheDir for openCL", cacheDir.c_str());
#endif

if (cacheDir.empty()) {
cacheDir = reader.getSetting("HOME", emptyString);
if (cacheDir.empty()) {
return false;
}
#ifdef ANDROID
ALOGE("Ratne1: %s: CacheDir2 for openCL", cacheDir.c_str());
#endif

// .cache might not exist on fresh installation
cacheDir = joinPath(cacheDir, ".cache/");
if (!NEO::SysCalls::pathExists(cacheDir)) {
if (!NEO::SysCalls::pathExists(cacheDir)) {
NEO::SysCalls::mkdir(cacheDir);
}
#ifdef ANDROID
ALOGE("Ratne1: %s: CacheDir3 for openCL", cacheDir.c_str());
#endif

return createCompilerCachePath(cacheDir);
return createCompilerCachePath(cacheDir);
}

if (NEO::SysCalls::pathExists(cacheDir)) {
#ifdef ANDROID
ALOGE("Ratne1: %s: CacheDir4 for openCL", cacheDir.c_str());
#endif
return createCompilerCachePath(cacheDir);
}

#ifdef ANDROID
ALOGE("Ratne1: %s: CacheDir5 for openCL", cacheDir.c_str());
#endif
return false;
}

Expand All @@ -85,4 +103,4 @@ size_t getFileSize(const std::string &path) {
}
return 0u;
}
} // namespace NEO
} // namespace NEO