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

Pr/batched test shade #1298

Merged

Conversation

AlexMWells
Copy link
Contributor

@AlexMWells AlexMWells commented Nov 12, 2020

Implement BatchedSimpleRenderer for TestShade.

Derives from BatchedRendererServices and make use of Masked<typename DataT, int WidthT>wrappers and MaskedData<WidthT> and RefData wrappers for variant data. Provides examples usages of these encapsulations, intent is actual data served up through the BatchedSimpleRenderer matches that of SimpleRenderer so the same unit tests could eventually work in -batched mode. This means any changes made in SimpleRenderer shoud be mimicked in BatchedSimpleRenderer. The BatchedSimpleRenderer does pull its values from the SimpleRenderer instance and adapts them to varying or uniform parameters of its methods.
A conscious decision was made to duplicate some code vs. refactoring SimpleRenderer to share.

Conflicts:
	src/include/OSL/mask.h
to store upto WidthT instances of ShaderGlobal data.  The data for a batch is broken into underlying uniform and varying data structures.  Uniform contains a fixed set of shader global values that are shared between all instances.  Varying has Block<DataT, WidthT> members so each instance can hold a different value.  The Block data structure is specialized to hold the underlying data type in a SIMD friendly Structure of Arrays (SOA) data layout but provides an array subscript interface to a proxy that can import/export the DataT in its orignal data layout.

Introduce template<int WidthT> class ShadingSystem::BatchedExecutor as an interface to execute batches of shader globals through a shader network.  BatchedExecutor provides similar execute methods that accept a BatchedShaderGlobals and batchSize instead of individual ShaderGlobal(s). This is just the interface, batched backend implemention to follow in subsequent pull requests.

Introduce template<typename DataT, int WidthT> Wide to hold a reference to Block<DataT, WidthT> and provide access to the underlying SOA data layout.  Wide can handle array types and const correctness.  The Wide adapter is lightweight and can be copied by value, used as function parameter.

Once batched execution finishes, the resulting symbol address can be passed to a Wide<DataT, Width> to access the resulting data in a type safe manner.

Updated testshade with command line option "--batched" causing batched execution of 16 or 8 instances through the shader network and to extract the results.  A later pull request will add batched interface to renderer services.
… during SIMD execution, BatchedTextureOptions, Masked<typename DataT, int WidthT>
Conflicts:
	src/include/OSL/wide.h
Conflicts:
	src/include/OSL/oslexec.h
	src/include/OSL/wide.h
…ions is_overriden_*().

Improved some comments for BatchedRendererServices.h
Workaround some QT macro issues.
…its methods are never directly called.

Fixed up issues with OSL_USING_DATA_WIDTH(WIDTH) macro.
…and ::first_on()

Moved documentation for Wide, Masked, and other classes in wide.h from top overview to be near class definition.
Fixed some typos.
Copy link
Collaborator

@lgritz lgritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lgritz lgritz merged commit ea3f571 into AcademySoftwareFoundation:master Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants