Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move OSL library functions and remaining execution time interface from ustring to ustringhash. Intent is all code for cpu or device just use ustringhash only. This allows us to remove STRING_PARAM, ustringrep, and OSL_USTRINGREP_IS_HASH. All interfaces and library code should explicitly use ustringhash or ustring, or for library functions llvm can call ustringhash_pod or ustring_pod Compile time strings used in the OSL Library are represented in strdecls.h and will be available as ustring variables in the Strings namespace as well as available as unstringhash constexpr variables in the Hashes namespace. Compile time strings used by the Renderer should adopt a similiar strategy as exemplified by TestShade which keeps its strings in rs_strdecls.h and made available as ustring variables in the RS::Strings namespace as well as available as unstringhash constexpr variables in the RS::Hashes namespace. Added helper utility functions to generate ustring from ustringhash_pods Constant string arrays: Previously, array copys required copying data via address of symbol on host. To enable working on device, replaced memcpy with array allocation and loading of values. Constant arrays are now present as global arrays in final llvm module. On the Batched side compatability/integration: Batched OSL Library functions continue to use ustrings (not ustringhashes to reduce scope/risk). Batched OSL library functions that call their scalar counterparts were adjusted to pass arguments as ustringhash_pods and store results as ustrings STRING_PARAMS, device_string.h, and string_hash.h: Built-in strings on the CUDA side are now accessed via Hashes namespace, instead of STRING_PARAMS and are evaluated as ustringhashes. Similarly, DeviceString, StringParams, HDSTR are obsolete, and device_string.h is eliminated. Hashes.h, which only contains OIIO's strhash and pvtstrlen functions (both formerly in string_hash.h), replaces all inclusions of device_string.h. Namespace Hashes in hashes.h contains pre-compiled ustringhashes representing strings from strdecls.h. Texture, dictionary, closure: Helper implementation functions are used by both scalar and batched versions. However, since scalar uses ustringhashes and the batched version uses ustrings added a flag to inform functions on treating TypeDesc::STRING has either a ustring or a ustringhash testing: Added testing of bitcode rendereservices for unoptimized OSL shader. array-copy tests regression: Added new test to verify copying of arrays of unequal lengths Signed-off-by: Steena Monteiro <[email protected]> * Deleted liboslexec/string_hash.h Signed-off-by: Steena Monteiro <[email protected]> * Modified rs_get_attribute to use OpaqueExecutionContext and ustringhash. Changed example programs--testshade, testrenderer, and osltoy--to use device friendly constexpr (RS|OSL)::Hashes and (RS|OSL)::Strings variables with rs_strdecls.h vs constructing ustrings on the fly. Signed-off-by: Steena Monteiro <[email protected]> * Fixed clang format issues; added uint64_t casts for constant64; removed unused variable; added array-copy to testsuite Signed-off-by: Steena Monteiro <[email protected]> * Fixed clang format issues in llvm_instance.cpp Signed-off-by: Steena Monteiro <[email protected]> * Added fix in llvm_assign_impl for assignment of non-constant scalar to an array Signed-off-by: Steena Monteiro <[email protected]> * Fixed clang-format in simplerend.cpp. Signed-off-by: Steena Monteiro <[email protected]> * Addressed review comments -- (1) Added ll.constant(ustring().cstr()) in llvm_gen and batched_llvm_gen and (2) Added comments for boolean arguments that indicate ustrings are treated as hashes Signed-off-by: Steena Monteiro <[email protected]> * Addressed comments on Optix build failures Signed-off-by: Steena Monteiro <[email protected]> * Resolved merge conflicts Signed-off-by: Steena Monteiro <[email protected]> * Fixed clang-format Signed-off-by: Steena Monteiro <[email protected]> * Fixed split-reg for batched Signed-off-by: Steena Monteiro <[email protected]> * Replaced llvm_load_stringhash with llvm_const_hash; Changed format string to ustringhash_pod in osl_printf, osl_fprintf, osl_warning, osl_error stubs; Fixed ShaderGlobals' position, u, and v in optix_grid_renderer.cu. Signed-off-by: Steena Monteiro <[email protected]> --------- Signed-off-by: Steena Monteiro <[email protected]> Signed-off-by: Larry Gritz <[email protected]> Co-authored-by: Larry Gritz <[email protected]>
- Loading branch information