Commit ac1b354e authored by cianciosa's avatar cianciosa
Browse files

Fix 2D indices when using index cache.

parent b74f2fff
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1726,6 +1726,7 @@
					"\"CXX_ARGS=\\\"-I/Users/m4c/Projects/graph_framework/graph_framework -I/usr/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks -fgnuc-version=4.2.1 -std=gnu++2a\\\"\"",
					STATIC,
					"MACOS_LIB_RT=\\\"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17.0.0/lib/darwin/libclang_rt.osx.a\\\"",
					USE_INDEX_CACHE,
					"USE_VERBOSE=false",
					"$(inherited)",
				);
@@ -1792,6 +1793,7 @@
					"-lLLVMFrontendDriver",
					"-lLLVMFrontendHLSL",
					"-lLLVMFrontendOpenMP",
					"-lLLVMFrontendDirective",
					"-lLLVMFrontendOffloading",
					"-lLLVMSelectionDAG",
					"-lLLVMProfileData",
@@ -1813,6 +1815,7 @@
					"-lLLVMAArch64Info",
					"-lLLVMAArch64Desc",
					"-lLLVMAArch64AsmParser",
					"-lLLVMDebugInfoDWARFLowLevel",
					"-lLLVMAArch64CodeGen",
					"-lLLVMCGData",
					"-lLLVMSandboxIR",
@@ -1958,6 +1961,7 @@
					"-lLLVMFrontendDriver",
					"-lLLVMFrontendHLSL",
					"-lLLVMFrontendOpenMP",
					"-lLLVMFrontendDirective",
					"-lLLVMFrontendOffloading",
					"-lLLVMSelectionDAG",
					"-lLLVMProfileData",
@@ -1979,6 +1983,7 @@
					"-lLLVMAArch64Info",
					"-lLLVMAArch64Desc",
					"-lLLVMAArch64AsmParser",
					"-lLLVMDebugInfoDWARFLowLevel",
					"-lLLVMAArch64CodeGen",
					"-lLLVMCGData",
					"-lLLVMSandboxIR",
+17 −20
Original line number Diff line number Diff line
@@ -968,14 +968,17 @@ void compile_index(std::ostringstream &stream,
                const size_t length = leaf_node<T, SAFE_MATH>::caches.backends[data_hash].size();
                const size_t num_rows = length/num_columns;

#ifdef USE_INDEX_CACHE
                if (indices.find(this->left.get()) == indices.end()) {
#endif
                shared_leaf<T, SAFE_MATH> x = this->left->compile(stream,
                                                                  registers,
                                                                  indices,
                                                                  usage);
                shared_leaf<T, SAFE_MATH> y = this->right->compile(stream,
                                                                   registers,
                                                                   indices,
                                                                   usage);

#ifdef USE_INDEX_CACHE
                if (indices.find(x.get()) == indices.end()) {
                    indices[x.get()] = jit::to_string('i', x.get());
                    stream << "        const "
                           << jit::smallest_int_type<T> (num_rows) << " "
@@ -984,13 +987,7 @@ void compile_index(std::ostringstream &stream,
                                      x_scale, x_offset);
                    x->endline(stream, usage);
                }
                if (indices.find(this->right.get()) == indices.end()) {
#endif
                    shared_leaf<T, SAFE_MATH> y = this->right->compile(stream,
                                                                       registers,
                                                                       indices,
                                                                       usage);
#ifdef USE_INDEX_CACHE
                if (indices.find(y.get()) == indices.end()) {
                    indices[y.get()] = jit::to_string('i', y.get());
                    stream << "        const "
                           << jit::smallest_int_type<T> (num_columns) << " "
@@ -1012,9 +1009,9 @@ void compile_index(std::ostringstream &stream,
                        stream << "        const "
                               << jit::smallest_int_type<T> (length) << " "
                               << indices[temp.get()] << " = "
                               << indices[this->left.get()]
                               << indices[x.get()]
                               << "*" << num_columns << " + "
                               << indices[this->right.get()]
                               << indices[y.get()]
                               << ";" << std::endl;
                    }
                }
@@ -1048,9 +1045,9 @@ void compile_index(std::ostringstream &stream,
                           << jit::smallest_int_type<T> (std::max(num_rows,
                                                                  num_columns))
                           << "2("
                           << indices[this->right.get()]
                           << indices[y.get()]
                           << ","
                           << indices[this->left.get()]
                           << indices[x.get()]
                           << ")).r";
#else
                    stream << ".read(uint2(";
@@ -1065,9 +1062,9 @@ void compile_index(std::ostringstream &stream,
                } else if constexpr (jit::use_cuda()) {
#ifdef USE_INDEX_CACHE
                    stream << ", "
                           << indices[this->right.get()]
                           << indices[y.get()]
                           << ", "
                           << indices[this->left.get()];
                           << indices[x.get()];
#else
                    stream << ", ";
                    compile_index<T> (stream, registers[y.get()], num_columns,