diff options
| author | Yong He <yonghe@outlook.com> | 2020-11-10 14:55:36 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-10 14:55:36 -0800 |
| commit | 7bcc2b15c8be4aebc6b9b8f05af6db7a451b228b (patch) | |
| tree | 2b89d5deaa9992cdb8c6c1ff72a399a5176be802 /tools | |
| parent | 1c4d768bc1b400ab40c10715df98d0b2122bcd66 (diff) | |
Use integer RTTI/witness handles in existential tuples. (#1598)
* Use integer RTTI/witness handles in existential tuples.
* Fix clang error.
* Fix IR serialization to use 16bits for opcode.
* Undo accidental comment change.
* Use variable length encoding for opcode.
* Fix compile error.
* Fixing issues
* Fix code review issues.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/render-test/cpu-compute-util.cpp | 14 | ||||
| -rw-r--r-- | tools/render-test/cuda/cuda-compute-util.cpp | 20 |
2 files changed, 11 insertions, 23 deletions
diff --git a/tools/render-test/cpu-compute-util.cpp b/tools/render-test/cpu-compute-util.cpp index a861dadf3..72e44fb78 100644 --- a/tools/render-test/cpu-compute-util.cpp +++ b/tools/render-test/cpu-compute-util.cpp @@ -427,7 +427,7 @@ SlangResult CPUComputeUtil::fillRuntimeHandleInBuffers( { for (auto& rtti : entry.rttiEntries) { - void* ptrValue = nullptr; + uint64_t ptrValue = 0; switch (rtti.type) { case RTTIDataEntryType::RTTIObject: @@ -439,7 +439,7 @@ SlangResult CPUComputeUtil::fillRuntimeHandleInBuffers( linkage->getTypeRTTIMangledName(concreteType, outName.writeRef()); if (!outName) return SLANG_FAIL; - ptrValue = sharedLib->findSymbolAddressByName((char*)outName->getBufferPointer()); + ptrValue = (uint64_t)sharedLib->findSymbolAddressByName((char*)outName->getBufferPointer()); } break; case RTTIDataEntryType::WitnessTable: @@ -451,18 +451,14 @@ SlangResult CPUComputeUtil::fillRuntimeHandleInBuffers( auto interfaceType = reflection->findTypeByName(rtti.interfaceName.getBuffer()); if (!interfaceType) return SLANG_FAIL; - ComPtr<ISlangBlob> outName; - linkage->getTypeConformanceWitnessMangledName(concreteType, interfaceType, outName.writeRef()); - if (!outName) - return SLANG_FAIL; - ptrValue = sharedLib->findSymbolAddressByName((char*)outName->getBufferPointer()); + uint32_t id = -1; + linkage->getTypeConformanceWitnessSequentialID(concreteType, interfaceType, &id); + ptrValue = id; break; } default: break; } - if (!ptrValue) - return SLANG_FAIL; if (rtti.offset >= 0 && rtti.offset + sizeof(ptrValue) <= entry.bufferData.getCount() * sizeof(decltype(entry.bufferData[0]))) { memcpy( diff --git a/tools/render-test/cuda/cuda-compute-util.cpp b/tools/render-test/cuda/cuda-compute-util.cpp index 73ad78f0b..cc84d4a00 100644 --- a/tools/render-test/cuda/cuda-compute-util.cpp +++ b/tools/render-test/cuda/cuda-compute-util.cpp @@ -1409,7 +1409,7 @@ static SlangResult _fillRuntimeHandlesInBuffers( { for (auto& rtti : entry.rttiEntries) { - CUdeviceptr ptrValue = 0; + uint64_t ptrValue = 0; switch (rtti.type) { case RTTIDataEntryType::RTTIObject: @@ -1422,7 +1422,7 @@ static SlangResult _fillRuntimeHandlesInBuffers( if (!outName) return SLANG_FAIL; SLANG_CUDA_RETURN_ON_FAIL(cuModuleGetGlobal( - &ptrValue, + (CUdeviceptr*)&ptrValue, nullptr, cudaModule.m_module, (char*)outName->getBufferPointer())); @@ -1438,23 +1438,15 @@ static SlangResult _fillRuntimeHandlesInBuffers( auto interfaceType = reflection->findTypeByName(rtti.interfaceName.getBuffer()); if (!interfaceType) return SLANG_FAIL; - ComPtr<ISlangBlob> outName; - linkage->getTypeConformanceWitnessMangledName( - concreteType, interfaceType, outName.writeRef()); - if (!outName) - return SLANG_FAIL; - SLANG_CUDA_RETURN_ON_FAIL(cuModuleGetGlobal( - &ptrValue, - nullptr, - cudaModule.m_module, - (char*)outName->getBufferPointer())); + uint32_t id = 0xFFFFFFFF; + linkage->getTypeConformanceWitnessSequentialID( + concreteType, interfaceType, &id); + ptrValue = id; break; } default: break; } - if (!ptrValue) - return SLANG_FAIL; if (rtti.offset >= 0 && rtti.offset + sizeof(ptrValue) <= entry.bufferData.getCount() * sizeof(decltype(entry.bufferData[0]))) |
