rsCpuScript.cpp revision 508b1afdff080ccb8546021649559fc5c720aecd
1/* 2 * Copyright (C) 2011-2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "rsCpuCore.h" 18#include "rsCpuScript.h" 19 20#ifdef RS_COMPATIBILITY_LIB 21 #include <stdio.h> 22 #include <sys/stat.h> 23 #include <unistd.h> 24#else 25 #include <bcc/BCCContext.h> 26 #include <bcc/Config/Config.h> 27 #include <bcc/Renderscript/RSCompilerDriver.h> 28 #include <bcinfo/MetadataExtractor.h> 29 #include <cutils/properties.h> 30 31 #include <sys/types.h> 32 #include <sys/wait.h> 33 #include <unistd.h> 34 35 #include <string> 36 #include <vector> 37#endif 38 39#include <set> 40#include <string> 41#include <dlfcn.h> 42#include <stdlib.h> 43#include <string.h> 44#include <fstream> 45#include <iostream> 46 47#ifdef __LP64__ 48#define SYSLIBPATH "/system/lib64" 49#else 50#define SYSLIBPATH "/system/lib" 51#endif 52 53namespace { 54 55// Create a len length string containing random characters from [A-Za-z0-9]. 56static std::string getRandomString(size_t len) { 57 char buf[len + 1]; 58 for (size_t i = 0; i < len; i++) { 59 uint32_t r = arc4random() & 0xffff; 60 r %= 62; 61 if (r < 26) { 62 // lowercase 63 buf[i] = 'a' + r; 64 } else if (r < 52) { 65 // uppercase 66 buf[i] = 'A' + (r - 26); 67 } else { 68 // Use a number 69 buf[i] = '0' + (r - 52); 70 } 71 } 72 buf[len] = '\0'; 73 return std::string(buf); 74} 75 76// Check if a path exists and attempt to create it if it doesn't. 77static bool ensureCacheDirExists(const char *path) { 78 if (access(path, R_OK | W_OK | X_OK) == 0) { 79 // Done if we can rwx the directory 80 return true; 81 } 82 if (mkdir(path, 0700) == 0) { 83 return true; 84 } 85 return false; 86} 87 88// Copy the file named \p srcFile to \p dstFile. 89// Return 0 on success and -1 if anything wasn't copied. 90static int copyFile(const char *dstFile, const char *srcFile) { 91 std::ifstream srcStream(srcFile); 92 if (!srcStream) { 93 ALOGE("Could not verify or read source file: %s", srcFile); 94 return -1; 95 } 96 std::ofstream dstStream(dstFile); 97 if (!dstStream) { 98 ALOGE("Could not verify or write destination file: %s", dstFile); 99 return -1; 100 } 101 dstStream << srcStream.rdbuf(); 102 if (!dstStream) { 103 ALOGE("Could not write destination file: %s", dstFile); 104 return -1; 105 } 106 107 srcStream.close(); 108 dstStream.close(); 109 110 return 0; 111} 112 113static std::string findSharedObjectName(const char *cacheDir, 114 const char *resName) { 115#ifndef RS_SERVER 116 std::string scriptSOName(cacheDir); 117#if defined(RS_COMPATIBILITY_LIB) && !defined(__LP64__) 118 size_t cutPos = scriptSOName.rfind("cache"); 119 if (cutPos != std::string::npos) { 120 scriptSOName.erase(cutPos); 121 } else { 122 ALOGE("Found peculiar cacheDir (missing \"cache\"): %s", cacheDir); 123 } 124 scriptSOName.append("/lib/librs."); 125#else 126 scriptSOName.append("/librs."); 127#endif // RS_COMPATIBILITY_LIB 128 129#else 130 std::string scriptSOName("lib"); 131#endif // RS_SERVER 132 scriptSOName.append(resName); 133 scriptSOName.append(".so"); 134 135 return scriptSOName; 136} 137 138#ifndef RS_COMPATIBILITY_LIB 139 140static bool is_force_recompile() { 141#ifdef RS_SERVER 142 return false; 143#else 144 char buf[PROPERTY_VALUE_MAX]; 145 146 // Re-compile if floating point precision has been overridden. 147 property_get("debug.rs.precision", buf, ""); 148 if (buf[0] != '\0') { 149 return true; 150 } 151 152 // Re-compile if debug.rs.forcerecompile is set. 153 property_get("debug.rs.forcerecompile", buf, "0"); 154 if ((::strcmp(buf, "1") == 0) || (::strcmp(buf, "true") == 0)) { 155 return true; 156 } else { 157 return false; 158 } 159#endif // RS_SERVER 160} 161 162static void setCompileArguments(std::vector<const char*>* args, 163 const std::string& bcFileName, 164 const char* cacheDir, const char* resName, 165 const char* core_lib, bool useRSDebugContext, 166 const char* bccPluginName) { 167 rsAssert(cacheDir && resName && core_lib); 168 args->push_back(android::renderscript::RsdCpuScriptImpl::BCC_EXE_PATH); 169 args->push_back("-unroll-runtime"); 170 args->push_back("-scalarize-load-store"); 171 args->push_back("-o"); 172 args->push_back(resName); 173 args->push_back("-output_path"); 174 args->push_back(cacheDir); 175 args->push_back("-bclib"); 176 args->push_back(core_lib); 177 args->push_back("-mtriple"); 178 args->push_back(DEFAULT_TARGET_TRIPLE_STRING); 179 180 // Enable workaround for A53 codegen by default. 181#if defined(__aarch64__) && !defined(DISABLE_A53_WORKAROUND) 182 args->push_back("-aarch64-fix-cortex-a53-835769"); 183#endif 184 185 // Execute the bcc compiler. 186 if (useRSDebugContext) { 187 args->push_back("-rs-debug-ctx"); 188 } else { 189 // Only load additional libraries for compiles that don't use 190 // the debug context. 191 if (bccPluginName && strlen(bccPluginName) > 0) { 192 args->push_back("-load"); 193 args->push_back(bccPluginName); 194 } 195 } 196 197 args->push_back("-fPIC"); 198 args->push_back("-embedRSInfo"); 199 200 args->push_back(bcFileName.c_str()); 201 args->push_back(nullptr); 202} 203 204static bool compileBitcode(const std::string &bcFileName, 205 const char *bitcode, 206 size_t bitcodeSize, 207 const char **compileArguments, 208 const std::string &compileCommandLine) { 209 rsAssert(bitcode && bitcodeSize); 210 211 FILE *bcfile = fopen(bcFileName.c_str(), "w"); 212 if (!bcfile) { 213 ALOGE("Could not write to %s", bcFileName.c_str()); 214 return false; 215 } 216 size_t nwritten = fwrite(bitcode, 1, bitcodeSize, bcfile); 217 fclose(bcfile); 218 if (nwritten != bitcodeSize) { 219 ALOGE("Could not write %zu bytes to %s", bitcodeSize, 220 bcFileName.c_str()); 221 return false; 222 } 223 224 pid_t pid = fork(); 225 226 switch (pid) { 227 case -1: { // Error occurred (we attempt no recovery) 228 ALOGE("Couldn't fork for bcc compiler execution"); 229 return false; 230 } 231 case 0: { // Child process 232 ALOGV("Invoking BCC with: %s", compileCommandLine.c_str()); 233 execv(android::renderscript::RsdCpuScriptImpl::BCC_EXE_PATH, 234 (char* const*)compileArguments); 235 236 ALOGE("execv() failed: %s", strerror(errno)); 237 abort(); 238 return false; 239 } 240 default: { // Parent process (actual driver) 241 // Wait on child process to finish compiling the source. 242 int status = 0; 243 pid_t w = waitpid(pid, &status, 0); 244 if (w == -1) { 245 ALOGE("Could not wait for bcc compiler"); 246 return false; 247 } 248 249 if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { 250 return true; 251 } 252 253 ALOGE("bcc compiler terminated unexpectedly"); 254 return false; 255 } 256 } 257} 258 259std::string getCommandLine(int argc, const char* const* argv) { 260 std::string s; 261 for (int i = 0; i < argc; i++) { 262 if (i > 0) { 263 s += ' '; 264 } 265 s += argv[i]; 266 } 267 return s; 268} 269 270#endif // !defined(RS_COMPATIBILITY_LIB) 271} // namespace 272 273namespace android { 274namespace renderscript { 275 276const char* SharedLibraryUtils::LD_EXE_PATH = "/system/bin/ld.mc"; 277const char* SharedLibraryUtils::RS_CACHE_DIR = "com.android.renderscript.cache"; 278 279#ifndef RS_COMPATIBILITY_LIB 280 281bool SharedLibraryUtils::createSharedLibrary(const char *cacheDir, const char *resName) { 282 std::string sharedLibName = findSharedObjectName(cacheDir, resName); 283 std::string objFileName = cacheDir; 284 objFileName.append("/"); 285 objFileName.append(resName); 286 objFileName.append(".o"); 287 288 const char *compiler_rt = SYSLIBPATH"/libcompiler_rt.so"; 289 std::vector<const char *> args = { 290 LD_EXE_PATH, 291 "-shared", 292 "-nostdlib", 293 compiler_rt, 294 "-mtriple", DEFAULT_TARGET_TRIPLE_STRING, 295 "-L", SYSLIBPATH, 296 "-lRSDriver", "-lm", "-lc", 297 objFileName.c_str(), 298 "-o", sharedLibName.c_str(), 299 nullptr 300 }; 301 302 std::string cmdLineStr = getCommandLine(args.size()-1, args.data()); 303 304 pid_t pid = fork(); 305 306 switch (pid) { 307 case -1: { // Error occurred (we attempt no recovery) 308 ALOGE("Couldn't fork for linker (%s) execution", LD_EXE_PATH); 309 return false; 310 } 311 case 0: { // Child process 312 ALOGV("Invoking ld.mc with args '%s'", cmdLineStr.c_str()); 313 execv(LD_EXE_PATH, (char* const*) args.data()); 314 315 ALOGE("execv() failed: %s", strerror(errno)); 316 abort(); 317 return false; 318 } 319 default: { // Parent process (actual driver) 320 // Wait on child process to finish compiling the source. 321 int status = 0; 322 pid_t w = waitpid(pid, &status, 0); 323 if (w == -1) { 324 ALOGE("Could not wait for linker (%s)", LD_EXE_PATH); 325 return false; 326 } 327 328 if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { 329 return true; 330 } 331 332 ALOGE("Linker (%s) terminated unexpectedly", LD_EXE_PATH); 333 return false; 334 } 335 } 336} 337 338#endif // RS_COMPATIBILITY_LIB 339 340 341void* SharedLibraryUtils::loadSharedLibrary(const char *cacheDir, const char *resName, const char *nativeLibDir) { 342 void *loaded = nullptr; 343 344#if defined(RS_COMPATIBILITY_LIB) && defined(__LP64__) 345 std::string scriptSOName = findSharedObjectName(nativeLibDir, resName); 346#else 347 std::string scriptSOName = findSharedObjectName(cacheDir, resName); 348#endif 349 350 // We should check if we can load the library from the standard app 351 // location for shared libraries first. 352 loaded = loadSOHelper(scriptSOName.c_str(), cacheDir, resName); 353 354 if (loaded == nullptr) { 355 ALOGE("Unable to open shared library (%s): %s", 356 scriptSOName.c_str(), dlerror()); 357 358#ifdef RS_COMPATIBILITY_LIB 359 // One final attempt to find the library in "/system/lib". 360 // We do this to allow bundled applications to use the compatibility 361 // library fallback path. Those applications don't have a private 362 // library path, so they need to install to the system directly. 363 // Note that this is really just a testing path. 364 std::string scriptSONameSystem("/system/lib/librs."); 365 scriptSONameSystem.append(resName); 366 scriptSONameSystem.append(".so"); 367 loaded = loadSOHelper(scriptSONameSystem.c_str(), cacheDir, 368 resName); 369 if (loaded == nullptr) { 370 ALOGE("Unable to open system shared library (%s): %s", 371 scriptSONameSystem.c_str(), dlerror()); 372 } 373#endif 374 } 375 376 return loaded; 377} 378 379void* SharedLibraryUtils::loadSOHelper(const char *origName, const char *cacheDir, 380 const char *resName) { 381 // Keep track of which .so libraries have been loaded. Once a library is 382 // in the set (per-process granularity), we must instead make a copy of 383 // the original shared object (randomly named .so file) and load that one 384 // instead. If we don't do this, we end up aliasing global data between 385 // the various Script instances (which are supposed to be completely 386 // independent). 387 static std::set<std::string> LoadedLibraries; 388 389 void *loaded = nullptr; 390 391 // Skip everything if we don't even have the original library available. 392 if (access(origName, F_OK) != 0) { 393 return nullptr; 394 } 395 396 // Common path is that we have not loaded this Script/library before. 397 if (LoadedLibraries.find(origName) == LoadedLibraries.end()) { 398 loaded = dlopen(origName, RTLD_NOW | RTLD_LOCAL); 399 if (loaded) { 400 LoadedLibraries.insert(origName); 401 } 402 return loaded; 403 } 404 405 std::string newName(cacheDir); 406 407 // Append RS_CACHE_DIR only if it is not found in cacheDir 408 // In driver mode, RS_CACHE_DIR is already appended to cacheDir. 409 if (newName.find(RS_CACHE_DIR) == std::string::npos) { 410 newName.append("/"); 411 newName.append(RS_CACHE_DIR); 412 newName.append("/"); 413 } 414 415 if (!ensureCacheDirExists(newName.c_str())) { 416 ALOGE("Could not verify or create cache dir: %s", cacheDir); 417 return nullptr; 418 } 419 420 // Construct an appropriately randomized filename for the copy. 421 newName.append("librs."); 422 newName.append(resName); 423 newName.append("#"); 424 newName.append(getRandomString(6)); // 62^6 potential filename variants. 425 newName.append(".so"); 426 427 int r = copyFile(newName.c_str(), origName); 428 if (r != 0) { 429 ALOGE("Could not create copy %s -> %s", origName, newName.c_str()); 430 return nullptr; 431 } 432 loaded = dlopen(newName.c_str(), RTLD_NOW | RTLD_LOCAL); 433 r = unlink(newName.c_str()); 434 if (r != 0) { 435 ALOGE("Could not unlink copy %s", newName.c_str()); 436 } 437 if (loaded) { 438 LoadedLibraries.insert(newName.c_str()); 439 } 440 441 return loaded; 442} 443 444const char* RsdCpuScriptImpl::BCC_EXE_PATH = "/system/bin/bcc"; 445 446#define MAXLINE 500 447#define MAKE_STR_HELPER(S) #S 448#define MAKE_STR(S) MAKE_STR_HELPER(S) 449#define EXPORT_VAR_STR "exportVarCount: " 450#define EXPORT_FUNC_STR "exportFuncCount: " 451#define EXPORT_FOREACH_STR "exportForEachCount: " 452#define OBJECT_SLOT_STR "objectSlotCount: " 453#define PRAGMA_STR "pragmaCount: " 454#define THREADABLE_STR "isThreadable: " 455 456// Copy up to a newline or size chars from str -> s, updating str 457// Returns s when successful and nullptr when '\0' is finally reached. 458static char* strgets(char *s, int size, const char **ppstr) { 459 if (!ppstr || !*ppstr || **ppstr == '\0' || size < 1) { 460 return nullptr; 461 } 462 463 int i; 464 for (i = 0; i < (size - 1); i++) { 465 s[i] = **ppstr; 466 (*ppstr)++; 467 if (s[i] == '\0') { 468 return s; 469 } else if (s[i] == '\n') { 470 s[i+1] = '\0'; 471 return s; 472 } 473 } 474 475 // size has been exceeded. 476 s[i] = '\0'; 477 478 return s; 479} 480 481RsdCpuScriptImpl::RsdCpuScriptImpl(RsdCpuReferenceImpl *ctx, const Script *s) { 482 mCtx = ctx; 483 mScript = s; 484 485 mScriptSO = nullptr; 486 487#ifndef RS_COMPATIBILITY_LIB 488 mCompilerDriver = nullptr; 489#endif 490 491 492 mRoot = nullptr; 493 mRootExpand = nullptr; 494 mInit = nullptr; 495 mFreeChildren = nullptr; 496 mScriptExec = nullptr; 497 498 mBoundAllocs = nullptr; 499 mIntrinsicData = nullptr; 500 mIsThreadable = true; 501} 502 503bool RsdCpuScriptImpl::storeRSInfoFromSO() { 504 mRoot = (RootFunc_t) dlsym(mScriptSO, "root"); 505 if (mRoot) { 506 //ALOGE("Found root(): %p", mRoot); 507 } 508 mRootExpand = (RootFunc_t) dlsym(mScriptSO, "root.expand"); 509 if (mRootExpand) { 510 //ALOGE("Found root.expand(): %p", mRootExpand); 511 } 512 mInit = (InvokeFunc_t) dlsym(mScriptSO, "init"); 513 if (mInit) { 514 //ALOGE("Found init(): %p", mInit); 515 } 516 mFreeChildren = (InvokeFunc_t) dlsym(mScriptSO, ".rs.dtor"); 517 if (mFreeChildren) { 518 //ALOGE("Found .rs.dtor(): %p", mFreeChildren); 519 } 520 521 mScriptExec = ScriptExecutable::createFromSharedObject( 522 mCtx->getContext(), mScriptSO); 523 524 if (mScriptExec == nullptr) { 525 return false; 526 } 527 528 size_t varCount = mScriptExec->getExportedVariableCount(); 529 if (varCount > 0) { 530 mBoundAllocs = new Allocation *[varCount]; 531 memset(mBoundAllocs, 0, varCount * sizeof(*mBoundAllocs)); 532 } 533 534 mIsThreadable = mScriptExec->getThreadable(); 535 //ALOGE("Script isThreadable? %d", mIsThreadable); 536 537 return true; 538} 539 540ScriptExecutable* ScriptExecutable::createFromSharedObject( 541 Context* RSContext, void* sharedObj) { 542 char line[MAXLINE]; 543 544 size_t varCount = 0; 545 size_t funcCount = 0; 546 size_t forEachCount = 0; 547 size_t objectSlotCount = 0; 548 size_t pragmaCount = 0; 549 bool isThreadable = true; 550 551 void** fieldAddress = nullptr; 552 bool* fieldIsObject = nullptr; 553 InvokeFunc_t* invokeFunctions = nullptr; 554 ForEachFunc_t* forEachFunctions = nullptr; 555 uint32_t* forEachSignatures = nullptr; 556 const char ** pragmaKeys = nullptr; 557 const char ** pragmaValues = nullptr; 558 559 const char *rsInfo = (const char *) dlsym(sharedObj, ".rs.info"); 560 561 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 562 return nullptr; 563 } 564 if (sscanf(line, EXPORT_VAR_STR "%zu", &varCount) != 1) { 565 ALOGE("Invalid export var count!: %s", line); 566 return nullptr; 567 } 568 569 fieldAddress = new void*[varCount]; 570 if (fieldAddress == nullptr) { 571 return nullptr; 572 } 573 574 fieldIsObject = new bool[varCount]; 575 if (fieldIsObject == nullptr) { 576 goto error; 577 } 578 579 for (size_t i = 0; i < varCount; ++i) { 580 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 581 goto error; 582 } 583 char *c = strrchr(line, '\n'); 584 if (c) { 585 *c = '\0'; 586 } 587 void* addr = dlsym(sharedObj, line); 588 if (addr == nullptr) { 589 ALOGE("Failed to find variable address for %s: %s", 590 line, dlerror()); 591 // Not a critical error if we don't find a global variable. 592 } 593 fieldAddress[i] = addr; 594 fieldIsObject[i] = false; 595 } 596 597 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 598 goto error; 599 } 600 if (sscanf(line, EXPORT_FUNC_STR "%zu", &funcCount) != 1) { 601 ALOGE("Invalid export func count!: %s", line); 602 goto error; 603 } 604 605 invokeFunctions = new InvokeFunc_t[funcCount]; 606 if (invokeFunctions == nullptr) { 607 goto error; 608 } 609 610 for (size_t i = 0; i < funcCount; ++i) { 611 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 612 goto error; 613 } 614 char *c = strrchr(line, '\n'); 615 if (c) { 616 *c = '\0'; 617 } 618 619 invokeFunctions[i] = (InvokeFunc_t) dlsym(sharedObj, line); 620 if (invokeFunctions[i] == nullptr) { 621 ALOGE("Failed to get function address for %s(): %s", 622 line, dlerror()); 623 goto error; 624 } 625 } 626 627 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 628 goto error; 629 } 630 if (sscanf(line, EXPORT_FOREACH_STR "%zu", &forEachCount) != 1) { 631 ALOGE("Invalid export forEach count!: %s", line); 632 goto error; 633 } 634 635 forEachFunctions = new ForEachFunc_t[forEachCount]; 636 if (forEachFunctions == nullptr) { 637 goto error; 638 } 639 640 forEachSignatures = new uint32_t[forEachCount]; 641 if (forEachSignatures == nullptr) { 642 goto error; 643 } 644 645 for (size_t i = 0; i < forEachCount; ++i) { 646 unsigned int tmpSig = 0; 647 char tmpName[MAXLINE]; 648 649 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 650 goto error; 651 } 652 if (sscanf(line, "%u - %" MAKE_STR(MAXLINE) "s", 653 &tmpSig, tmpName) != 2) { 654 ALOGE("Invalid export forEach!: %s", line); 655 goto error; 656 } 657 658 // Lookup the expanded ForEach kernel. 659 strncat(tmpName, ".expand", MAXLINE-1-strlen(tmpName)); 660 forEachSignatures[i] = tmpSig; 661 forEachFunctions[i] = 662 (ForEachFunc_t) dlsym(sharedObj, tmpName); 663 if (i != 0 && forEachFunctions[i] == nullptr) { 664 // Ignore missing root.expand functions. 665 // root() is always specified at location 0. 666 ALOGE("Failed to find forEach function address for %s: %s", 667 tmpName, dlerror()); 668 goto error; 669 } 670 } 671 672 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 673 goto error; 674 } 675 if (sscanf(line, OBJECT_SLOT_STR "%zu", &objectSlotCount) != 1) { 676 ALOGE("Invalid object slot count!: %s", line); 677 goto error; 678 } 679 680 for (size_t i = 0; i < objectSlotCount; ++i) { 681 uint32_t varNum = 0; 682 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 683 goto error; 684 } 685 if (sscanf(line, "%u", &varNum) != 1) { 686 ALOGE("Invalid object slot!: %s", line); 687 goto error; 688 } 689 690 if (varNum < varCount) { 691 fieldIsObject[varNum] = true; 692 } 693 } 694 695#ifndef RS_COMPATIBILITY_LIB 696 // Do not attempt to read pragmas or isThreadable flag in compat lib path. 697 // Neither is applicable for compat lib 698 699 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 700 goto error; 701 } 702 703 if (sscanf(line, PRAGMA_STR "%zu", &pragmaCount) != 1) { 704 ALOGE("Invalid pragma count!: %s", line); 705 goto error; 706 } 707 708 pragmaKeys = new const char*[pragmaCount]; 709 if (pragmaKeys == nullptr) { 710 goto error; 711 } 712 713 pragmaValues = new const char*[pragmaCount]; 714 if (pragmaValues == nullptr) { 715 goto error; 716 } 717 718 bzero(pragmaKeys, sizeof(char*) * pragmaCount); 719 bzero(pragmaValues, sizeof(char*) * pragmaCount); 720 721 for (size_t i = 0; i < pragmaCount; ++i) { 722 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 723 ALOGE("Unable to read pragma at index %zu!", i); 724 goto error; 725 } 726 727 char key[MAXLINE]; 728 char value[MAXLINE] = ""; // initialize in case value is empty 729 730 // pragmas can just have a key and no value. Only check to make sure 731 // that the key is not empty 732 if (sscanf(line, "%" MAKE_STR(MAXLINE) "s - %" MAKE_STR(MAXLINE) "s", 733 key, value) == 0 || 734 strlen(key) == 0) 735 { 736 ALOGE("Invalid pragma value!: %s", line); 737 738 goto error; 739 } 740 741 char *pKey = new char[strlen(key)+1]; 742 strcpy(pKey, key); 743 pragmaKeys[i] = pKey; 744 745 char *pValue = new char[strlen(value)+1]; 746 strcpy(pValue, value); 747 pragmaValues[i] = pValue; 748 //ALOGE("Pragma %zu: Key: '%s' Value: '%s'", i, pKey, pValue); 749 } 750 751 if (strgets(line, MAXLINE, &rsInfo) == nullptr) { 752 goto error; 753 } 754 755 char tmpFlag[4]; 756 if (sscanf(line, THREADABLE_STR "%4s", tmpFlag) != 1) { 757 ALOGE("Invalid threadable flag!: %s", line); 758 goto error; 759 } 760 if (strcmp(tmpFlag, "yes") == 0) { 761 isThreadable = true; 762 } else if (strcmp(tmpFlag, "no") == 0) { 763 isThreadable = false; 764 } else { 765 ALOGE("Invalid threadable flag!: %s", tmpFlag); 766 goto error; 767 } 768 769#endif // RS_COMPATIBILITY_LIB 770 771 return new ScriptExecutable( 772 RSContext, fieldAddress, fieldIsObject, varCount, 773 invokeFunctions, funcCount, 774 forEachFunctions, forEachSignatures, forEachCount, 775 pragmaKeys, pragmaValues, pragmaCount, 776 isThreadable); 777 778error: 779 780#ifndef RS_COMPATIBILITY_LIB 781 for (size_t idx = 0; idx < pragmaCount; ++idx) { 782 delete [] pragmaKeys[idx]; 783 delete [] pragmaValues[idx]; 784 } 785 786 delete[] pragmaValues; 787 delete[] pragmaKeys; 788#endif // RS_COMPATIBILITY_LIB 789 790 delete[] forEachSignatures; 791 delete[] forEachFunctions; 792 delete[] invokeFunctions; 793 delete[] fieldIsObject; 794 delete[] fieldAddress; 795 796 return nullptr; 797} 798 799bool RsdCpuScriptImpl::init(char const *resName, char const *cacheDir, 800 uint8_t const *bitcode, size_t bitcodeSize, 801 uint32_t flags, char const *bccPluginName) { 802 //ALOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, 803 // bitcode, bitcodeSize, flags, lookupFunc); 804 //ALOGE("rsdScriptInit %p %p", rsc, script); 805 806 mCtx->lockMutex(); 807#ifndef RS_COMPATIBILITY_LIB 808 bool useRSDebugContext = false; 809 810 mCompilerDriver = nullptr; 811 812 mCompilerDriver = new bcc::RSCompilerDriver(); 813 if (mCompilerDriver == nullptr) { 814 ALOGE("bcc: FAILS to create compiler driver (out of memory)"); 815 mCtx->unlockMutex(); 816 return false; 817 } 818 819 // Run any compiler setup functions we have been provided with. 820 RSSetupCompilerCallback setupCompilerCallback = 821 mCtx->getSetupCompilerCallback(); 822 if (setupCompilerCallback != nullptr) { 823 setupCompilerCallback(mCompilerDriver); 824 } 825 826 bcinfo::MetadataExtractor bitcodeMetadata((const char *) bitcode, bitcodeSize); 827 if (!bitcodeMetadata.extract()) { 828 ALOGE("Could not extract metadata from bitcode"); 829 mCtx->unlockMutex(); 830 return false; 831 } 832 833 const char* core_lib = findCoreLib(bitcodeMetadata, (const char*)bitcode, bitcodeSize); 834 835 if (mCtx->getContext()->getContextType() == RS_CONTEXT_TYPE_DEBUG) { 836 mCompilerDriver->setDebugContext(true); 837 useRSDebugContext = true; 838 } 839 840 std::string bcFileName(cacheDir); 841 bcFileName.append("/"); 842 bcFileName.append(resName); 843 bcFileName.append(".bc"); 844 845 std::vector<const char*> compileArguments; 846 setCompileArguments(&compileArguments, bcFileName, cacheDir, resName, core_lib, 847 useRSDebugContext, bccPluginName); 848 // The last argument of compileArguments ia a nullptr, so remove 1 from the size. 849 std::string compileCommandLine = 850 getCommandLine(compileArguments.size() - 1, compileArguments.data()); 851 852 if (!is_force_recompile() && !useRSDebugContext) { 853 mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName); 854 } 855 856 // If we can't, it's either not there or out of date. We compile the bit code and try loading 857 // again. 858 if (mScriptSO == nullptr) { 859 if (!compileBitcode(bcFileName, (const char*)bitcode, bitcodeSize, 860 compileArguments.data(), compileCommandLine)) 861 { 862 ALOGE("bcc: FAILS to compile '%s'", resName); 863 mCtx->unlockMutex(); 864 return false; 865 } 866 867 if (!SharedLibraryUtils::createSharedLibrary(cacheDir, resName)) { 868 ALOGE("Linker: Failed to link object file '%s'", resName); 869 mCtx->unlockMutex(); 870 return false; 871 } 872 873 mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName); 874 if (mScriptSO == nullptr) { 875 ALOGE("Unable to load '%s'", resName); 876 mCtx->unlockMutex(); 877 return false; 878 } 879 } 880 881 mBitcodeFilePath = bcFileName; 882 883 // Read RS symbol information from the .so. 884 if ( !mScriptSO) { 885 goto error; 886 } 887 888 if ( !storeRSInfoFromSO()) { 889 goto error; 890 } 891#else // RS_COMPATIBILITY_LIB is defined 892 const char *nativeLibDir = mCtx->getContext()->getNativeLibDir(); 893 mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName, nativeLibDir); 894 895 if (!mScriptSO) { 896 goto error; 897 } 898 899 if (!storeRSInfoFromSO()) { 900 goto error; 901 } 902#endif 903 mCtx->unlockMutex(); 904 return true; 905 906error: 907 908 mCtx->unlockMutex(); 909 if (mScriptSO) { 910 dlclose(mScriptSO); 911 mScriptSO = nullptr; 912 } 913 return false; 914} 915 916#ifndef RS_COMPATIBILITY_LIB 917 918const char* RsdCpuScriptImpl::findCoreLib(const bcinfo::MetadataExtractor& ME, const char* bitcode, 919 size_t bitcodeSize) { 920 const char* defaultLib = SYSLIBPATH"/libclcore.bc"; 921 922 // If we're debugging, use the debug library. 923 if (mCtx->getContext()->getContextType() == RS_CONTEXT_TYPE_DEBUG) { 924 return SYSLIBPATH"/libclcore_debug.bc"; 925 } 926 927 // If a callback has been registered to specify a library, use that. 928 RSSelectRTCallback selectRTCallback = mCtx->getSelectRTCallback(); 929 if (selectRTCallback != nullptr) { 930 return selectRTCallback((const char*)bitcode, bitcodeSize); 931 } 932 933 // Check for a platform specific library 934#if defined(ARCH_ARM_HAVE_NEON) && !defined(DISABLE_CLCORE_NEON) 935 enum bcinfo::RSFloatPrecision prec = ME.getRSFloatPrecision(); 936 if (prec == bcinfo::RS_FP_Relaxed) { 937 // NEON-capable ARMv7a devices can use an accelerated math library 938 // for all reduced precision scripts. 939 // ARMv8 does not use NEON, as ASIMD can be used with all precision 940 // levels. 941 return SYSLIBPATH"/libclcore_neon.bc"; 942 } else { 943 return defaultLib; 944 } 945#elif defined(__i386__) || defined(__x86_64__) 946 // x86 devices will use an optimized library. 947 return SYSLIBPATH"/libclcore_x86.bc"; 948#else 949 return defaultLib; 950#endif 951} 952 953#endif 954 955void RsdCpuScriptImpl::populateScript(Script *script) { 956 // Copy info over to runtime 957 script->mHal.info.exportedFunctionCount = mScriptExec->getExportedFunctionCount(); 958 script->mHal.info.exportedVariableCount = mScriptExec->getExportedVariableCount(); 959 script->mHal.info.exportedPragmaCount = mScriptExec->getPragmaCount();; 960 script->mHal.info.exportedPragmaKeyList = mScriptExec->getPragmaKeys(); 961 script->mHal.info.exportedPragmaValueList = mScriptExec->getPragmaValues(); 962 963 // Bug, need to stash in metadata 964 if (mRootExpand) { 965 script->mHal.info.root = mRootExpand; 966 } else { 967 script->mHal.info.root = mRoot; 968 } 969} 970 971 972typedef void (*rs_t)(const void *, void *, const void *, uint32_t, uint32_t, uint32_t, uint32_t); 973 974bool RsdCpuScriptImpl::forEachMtlsSetup(const Allocation ** ains, 975 uint32_t inLen, 976 Allocation * aout, 977 const void * usr, uint32_t usrLen, 978 const RsScriptCall *sc, 979 MTLaunchStruct *mtls) { 980 981 memset(mtls, 0, sizeof(MTLaunchStruct)); 982 983 for (int index = inLen; --index >= 0;) { 984 const Allocation* ain = ains[index]; 985 986 // possible for this to occur if IO_OUTPUT/IO_INPUT with no bound surface 987 if (ain != nullptr && 988 (const uint8_t *)ain->mHal.drvState.lod[0].mallocPtr == nullptr) { 989 990 mCtx->getContext()->setError(RS_ERROR_BAD_SCRIPT, 991 "rsForEach called with null in allocations"); 992 return false; 993 } 994 } 995 996 if (aout && 997 (const uint8_t *)aout->mHal.drvState.lod[0].mallocPtr == nullptr) { 998 999 mCtx->getContext()->setError(RS_ERROR_BAD_SCRIPT, 1000 "rsForEach called with null out allocations"); 1001 return false; 1002 } 1003 1004 if (inLen > 0) { 1005 const Allocation *ain0 = ains[0]; 1006 const Type *inType = ain0->getType(); 1007 1008 mtls->fep.dim.x = inType->getDimX(); 1009 mtls->fep.dim.y = inType->getDimY(); 1010 mtls->fep.dim.z = inType->getDimZ(); 1011 1012 for (int Index = inLen; --Index >= 1;) { 1013 if (!ain0->hasSameDims(ains[Index])) { 1014 mCtx->getContext()->setError(RS_ERROR_BAD_SCRIPT, 1015 "Failed to launch kernel; dimensions of input and output" 1016 "allocations do not match."); 1017 1018 return false; 1019 } 1020 } 1021 1022 } else if (aout != nullptr) { 1023 const Type *outType = aout->getType(); 1024 1025 mtls->fep.dim.x = outType->getDimX(); 1026 mtls->fep.dim.y = outType->getDimY(); 1027 mtls->fep.dim.z = outType->getDimZ(); 1028 1029 } else { 1030 mCtx->getContext()->setError(RS_ERROR_BAD_SCRIPT, 1031 "rsForEach called with null allocations"); 1032 return false; 1033 } 1034 1035 if (inLen > 0 && aout != nullptr) { 1036 if (!ains[0]->hasSameDims(aout)) { 1037 mCtx->getContext()->setError(RS_ERROR_BAD_SCRIPT, 1038 "Failed to launch kernel; dimensions of input and output allocations do not match."); 1039 1040 return false; 1041 } 1042 } 1043 1044 if (!sc || (sc->xEnd == 0)) { 1045 mtls->end.x = mtls->fep.dim.x; 1046 } else { 1047 mtls->start.x = rsMin(mtls->fep.dim.x, sc->xStart); 1048 mtls->end.x = rsMin(mtls->fep.dim.x, sc->xEnd); 1049 if (mtls->start.x >= mtls->end.x) return false; 1050 } 1051 1052 if (!sc || (sc->yEnd == 0)) { 1053 mtls->end.y = mtls->fep.dim.y; 1054 } else { 1055 mtls->start.y = rsMin(mtls->fep.dim.y, sc->yStart); 1056 mtls->end.y = rsMin(mtls->fep.dim.y, sc->yEnd); 1057 if (mtls->start.y >= mtls->end.y) return false; 1058 } 1059 1060 if (!sc || (sc->zEnd == 0)) { 1061 mtls->end.z = mtls->fep.dim.z; 1062 } else { 1063 mtls->start.z = rsMin(mtls->fep.dim.z, sc->zStart); 1064 mtls->end.z = rsMin(mtls->fep.dim.z, sc->zEnd); 1065 if (mtls->start.z >= mtls->end.z) return false; 1066 } 1067 1068 if (!sc || (sc->arrayEnd == 0)) { 1069 mtls->end.array[0] = mtls->fep.dim.array[0]; 1070 } else { 1071 mtls->start.array[0] = rsMin(mtls->fep.dim.array[0], sc->arrayStart); 1072 mtls->end.array[0] = rsMin(mtls->fep.dim.array[0], sc->arrayEnd); 1073 if (mtls->start.array[0] >= mtls->end.array[0]) return false; 1074 } 1075 1076 if (!sc || (sc->array2End == 0)) { 1077 mtls->end.array[1] = mtls->fep.dim.array[1]; 1078 } else { 1079 mtls->start.array[1] = rsMin(mtls->fep.dim.array[1], sc->array2Start); 1080 mtls->end.array[1] = rsMin(mtls->fep.dim.array[1], sc->array2End); 1081 if (mtls->start.array[1] >= mtls->end.array[1]) return false; 1082 } 1083 1084 if (!sc || (sc->array3End == 0)) { 1085 mtls->end.array[2] = mtls->fep.dim.array[2]; 1086 } else { 1087 mtls->start.array[2] = rsMin(mtls->fep.dim.array[2], sc->array3Start); 1088 mtls->end.array[2] = rsMin(mtls->fep.dim.array[2], sc->array3End); 1089 if (mtls->start.array[2] >= mtls->end.array[2]) return false; 1090 } 1091 1092 if (!sc || (sc->array4End == 0)) { 1093 mtls->end.array[3] = mtls->fep.dim.array[3]; 1094 } else { 1095 mtls->start.array[3] = rsMin(mtls->fep.dim.array[3], sc->array4Start); 1096 mtls->end.array[3] = rsMin(mtls->fep.dim.array[3], sc->array4End); 1097 if (mtls->start.array[3] >= mtls->end.array[3]) return false; 1098 } 1099 1100 1101 // The X & Y walkers always want 0-1 min even if dim is not present 1102 mtls->end.x = rsMax((uint32_t)1, mtls->end.x); 1103 mtls->end.y = rsMax((uint32_t)1, mtls->end.y); 1104 1105 mtls->rsc = mCtx; 1106 if (ains) { 1107 memcpy(mtls->ains, ains, inLen * sizeof(ains[0])); 1108 } 1109 mtls->aout[0] = aout; 1110 mtls->fep.usr = usr; 1111 mtls->fep.usrLen = usrLen; 1112 mtls->mSliceSize = 1; 1113 mtls->mSliceNum = 0; 1114 1115 mtls->isThreadable = mIsThreadable; 1116 1117 if (inLen > 0) { 1118 mtls->fep.inLen = inLen; 1119 for (int index = inLen; --index >= 0;) { 1120 mtls->fep.inPtr[index] = (const uint8_t*)ains[index]->mHal.drvState.lod[0].mallocPtr; 1121 mtls->fep.inStride[index] = ains[index]->getType()->getElementSizeBytes(); 1122 } 1123 } 1124 1125 if (aout != nullptr) { 1126 mtls->fep.outPtr[0] = (uint8_t *)aout->mHal.drvState.lod[0].mallocPtr; 1127 mtls->fep.outStride[0] = aout->getType()->getElementSizeBytes(); 1128 } 1129 1130 // All validation passed, ok to launch threads 1131 return true; 1132} 1133 1134 1135void RsdCpuScriptImpl::invokeForEach(uint32_t slot, 1136 const Allocation ** ains, 1137 uint32_t inLen, 1138 Allocation * aout, 1139 const void * usr, 1140 uint32_t usrLen, 1141 const RsScriptCall *sc) { 1142 1143 MTLaunchStruct mtls; 1144 1145 if (forEachMtlsSetup(ains, inLen, aout, usr, usrLen, sc, &mtls)) { 1146 forEachKernelSetup(slot, &mtls); 1147 1148 RsdCpuScriptImpl * oldTLS = mCtx->setTLS(this); 1149 mCtx->launchThreads(ains, inLen, aout, sc, &mtls); 1150 mCtx->setTLS(oldTLS); 1151 } 1152} 1153 1154void RsdCpuScriptImpl::forEachKernelSetup(uint32_t slot, MTLaunchStruct *mtls) { 1155 mtls->script = this; 1156 mtls->fep.slot = slot; 1157 mtls->kernel = mScriptExec->getForEachFunction(slot); 1158 rsAssert(mtls->kernel != nullptr); 1159 mtls->sig = mScriptExec->getForEachSignature(slot); 1160} 1161 1162int RsdCpuScriptImpl::invokeRoot() { 1163 RsdCpuScriptImpl * oldTLS = mCtx->setTLS(this); 1164 int ret = mRoot(); 1165 mCtx->setTLS(oldTLS); 1166 return ret; 1167} 1168 1169void RsdCpuScriptImpl::invokeInit() { 1170 if (mInit) { 1171 mInit(); 1172 } 1173} 1174 1175void RsdCpuScriptImpl::invokeFreeChildren() { 1176 if (mFreeChildren) { 1177 mFreeChildren(); 1178 } 1179} 1180 1181void RsdCpuScriptImpl::invokeFunction(uint32_t slot, const void *params, 1182 size_t paramLength) { 1183 //ALOGE("invoke %i %p %zu", slot, params, paramLength); 1184 void * ap = nullptr; 1185 1186#if defined(__x86_64__) 1187 // The invoked function could have input parameter of vector type for example float4 which 1188 // requires void* params to be 16 bytes aligned when using SSE instructions for x86_64 platform. 1189 // So try to align void* params before passing them into RS exported function. 1190 1191 if ((uint8_t)(uint64_t)params & 0x0F) { 1192 if ((ap = (void*)memalign(16, paramLength)) != nullptr) { 1193 memcpy(ap, params, paramLength); 1194 } else { 1195 ALOGE("x86_64: invokeFunction memalign error, still use params which" 1196 " is not 16 bytes aligned."); 1197 } 1198 } 1199#endif 1200 1201 RsdCpuScriptImpl * oldTLS = mCtx->setTLS(this); 1202 reinterpret_cast<void (*)(const void *, uint32_t)>( 1203 mScriptExec->getInvokeFunction(slot))(ap? (const void *) ap: params, paramLength); 1204 1205 mCtx->setTLS(oldTLS); 1206} 1207 1208void RsdCpuScriptImpl::setGlobalVar(uint32_t slot, const void *data, size_t dataLength) { 1209 //rsAssert(!script->mFieldIsObject[slot]); 1210 //ALOGE("setGlobalVar %i %p %zu", slot, data, dataLength); 1211 1212 //if (mIntrinsicID) { 1213 //mIntrinsicFuncs.setVar(dc, script, drv->mIntrinsicData, slot, data, dataLength); 1214 //return; 1215 //} 1216 1217 int32_t *destPtr = reinterpret_cast<int32_t *>(mScriptExec->getFieldAddress(slot)); 1218 if (!destPtr) { 1219 //ALOGV("Calling setVar on slot = %i which is null", slot); 1220 return; 1221 } 1222 1223 memcpy(destPtr, data, dataLength); 1224} 1225 1226void RsdCpuScriptImpl::getGlobalVar(uint32_t slot, void *data, size_t dataLength) { 1227 //rsAssert(!script->mFieldIsObject[slot]); 1228 //ALOGE("getGlobalVar %i %p %zu", slot, data, dataLength); 1229 1230 int32_t *srcPtr = reinterpret_cast<int32_t *>(mScriptExec->getFieldAddress(slot)); 1231 if (!srcPtr) { 1232 //ALOGV("Calling setVar on slot = %i which is null", slot); 1233 return; 1234 } 1235 memcpy(data, srcPtr, dataLength); 1236} 1237 1238 1239void RsdCpuScriptImpl::setGlobalVarWithElemDims(uint32_t slot, const void *data, size_t dataLength, 1240 const Element *elem, 1241 const uint32_t *dims, size_t dimLength) { 1242 int32_t *destPtr = reinterpret_cast<int32_t *>(mScriptExec->getFieldAddress(slot)); 1243 if (!destPtr) { 1244 //ALOGV("Calling setVar on slot = %i which is null", slot); 1245 return; 1246 } 1247 1248 // We want to look at dimension in terms of integer components, 1249 // but dimLength is given in terms of bytes. 1250 dimLength /= sizeof(int); 1251 1252 // Only a single dimension is currently supported. 1253 rsAssert(dimLength == 1); 1254 if (dimLength == 1) { 1255 // First do the increment loop. 1256 size_t stride = elem->getSizeBytes(); 1257 const char *cVal = reinterpret_cast<const char *>(data); 1258 for (uint32_t i = 0; i < dims[0]; i++) { 1259 elem->incRefs(cVal); 1260 cVal += stride; 1261 } 1262 1263 // Decrement loop comes after (to prevent race conditions). 1264 char *oldVal = reinterpret_cast<char *>(destPtr); 1265 for (uint32_t i = 0; i < dims[0]; i++) { 1266 elem->decRefs(oldVal); 1267 oldVal += stride; 1268 } 1269 } 1270 1271 memcpy(destPtr, data, dataLength); 1272} 1273 1274void RsdCpuScriptImpl::setGlobalBind(uint32_t slot, Allocation *data) { 1275 1276 //rsAssert(!script->mFieldIsObject[slot]); 1277 //ALOGE("setGlobalBind %i %p", slot, data); 1278 1279 int32_t *destPtr = reinterpret_cast<int32_t *>(mScriptExec->getFieldAddress(slot)); 1280 if (!destPtr) { 1281 //ALOGV("Calling setVar on slot = %i which is null", slot); 1282 return; 1283 } 1284 1285 void *ptr = nullptr; 1286 mBoundAllocs[slot] = data; 1287 if (data) { 1288 ptr = data->mHal.drvState.lod[0].mallocPtr; 1289 } 1290 memcpy(destPtr, &ptr, sizeof(void *)); 1291} 1292 1293void RsdCpuScriptImpl::setGlobalObj(uint32_t slot, ObjectBase *data) { 1294 1295 //rsAssert(script->mFieldIsObject[slot]); 1296 //ALOGE("setGlobalObj %i %p", slot, data); 1297 1298 int32_t *destPtr = reinterpret_cast<int32_t *>(mScriptExec->getFieldAddress(slot)); 1299 if (!destPtr) { 1300 //ALOGV("Calling setVar on slot = %i which is null", slot); 1301 return; 1302 } 1303 1304 rsrSetObject(mCtx->getContext(), (rs_object_base *)destPtr, data); 1305} 1306 1307RsdCpuScriptImpl::~RsdCpuScriptImpl() { 1308#ifndef RS_COMPATIBILITY_LIB 1309 if (mCompilerDriver) { 1310 delete mCompilerDriver; 1311 } 1312#endif 1313 1314 if (mScriptExec != nullptr) { 1315 delete mScriptExec; 1316 } 1317 if (mBoundAllocs) delete[] mBoundAllocs; 1318 if (mScriptSO) { 1319 dlclose(mScriptSO); 1320 } 1321} 1322 1323Allocation * RsdCpuScriptImpl::getAllocationForPointer(const void *ptr) const { 1324 if (!ptr) { 1325 return nullptr; 1326 } 1327 1328 for (uint32_t ct=0; ct < mScript->mHal.info.exportedVariableCount; ct++) { 1329 Allocation *a = mBoundAllocs[ct]; 1330 if (!a) continue; 1331 if (a->mHal.drvState.lod[0].mallocPtr == ptr) { 1332 return a; 1333 } 1334 } 1335 ALOGE("rsGetAllocation, failed to find %p", ptr); 1336 return nullptr; 1337} 1338 1339void RsdCpuScriptImpl::preLaunch(uint32_t slot, const Allocation ** ains, 1340 uint32_t inLen, Allocation * aout, 1341 const void * usr, uint32_t usrLen, 1342 const RsScriptCall *sc) {} 1343 1344void RsdCpuScriptImpl::postLaunch(uint32_t slot, const Allocation ** ains, 1345 uint32_t inLen, Allocation * aout, 1346 const void * usr, uint32_t usrLen, 1347 const RsScriptCall *sc) {} 1348 1349 1350} 1351} 1352