Remove pseudo-commands for mid-execution capture.#1527
Remove pseudo-commands for mid-execution capture.#1527AWoloszyn merged 30 commits intogoogle:masterfrom
Conversation
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| go_install() No newline at end of file |
There was a problem hiding this comment.
should this be go_installl(DESTINATION ${TARGET_INSTALL_PATH})?
cmd/linearize_trace/main.go
Outdated
| } | ||
|
|
||
| initialCmds := capt.GetInitialCommands(ctx) | ||
| _ = initialCmds |
| if err != nil { | ||
| return err | ||
| } | ||
|
|
gapii/cc/chunk_writer.cpp
Outdated
| void ChunkWriterImpl::flush() { | ||
| mStreamGood = mWriter->write(mBuffer.data(), mBuffer.size()); | ||
| size_t bufferSize = mBuffer.size(); | ||
| // If we flush en empty buffer, this will return false, which is incorrect. |
There was a problem hiding this comment.
I guess this comment is describing the stale code? Probably not necessary or should be changed for the new code here?
There was a problem hiding this comment.
Good question - Andrew?
There was a problem hiding this comment.
That is correct, removed the comment.
| #include <unordered_map> | ||
|
|
||
| namespace gapii { | ||
| const uint8_t kAllAPIs = 0xFF; |
There was a problem hiding this comment.
Probably we can change the getEncoder to make is accept a bit mask, instead the shift value, so we can avoid using this 'mask' like thing with the 'shift value' like thing in should_trace()? Hmm, probably not in this CL anyway.
There was a problem hiding this comment.
Yeah, I would prefer to leave this for a future CL.
| markerNameData.Data()).AddRead(markerInfoData.Data()), nil | ||
| } | ||
|
|
||
| func GetCommandArgs(ctx context.Context, |
There was a problem hiding this comment.
Probably we should add comment for it?
gapis/api/vulkan/externs.go
Outdated
| }) | ||
| } | ||
|
|
||
| func (e externs) callSub(ctx context.Context, cmd api.Cmd, id api.CmdID, s *api.GlobalState, b *rb.Builder, sub, data interface{}) { |
There was a problem hiding this comment.
Drop it? It is only used once.
| } | ||
| } | ||
|
|
||
| func GetCommandFunction(cr CommandReference) interface{} { |
gapis/api/vulkan/state_rebuilder.go
Outdated
|
|
||
| // TODO: wherever possible, use old resources instead of doing full reads on the old pools. | ||
| // This is especially useful for things that are internal pools, (Shader words for example) | ||
| func (s *State) RebuildState(ctx context.Context, oldState *api.GlobalState) []api.Cmd { |
| if numHandled == 0 { | ||
| // There is a cycle in the basePipeline indices. | ||
| // Or the no base pipelines does exist. | ||
| // Create the rest without base pipelines |
There was a problem hiding this comment.
Is it allowed to by cyclical? Probably we should emit an error in the report view for this?
There was a problem hiding this comment.
I am not sure if it is technically allowed, but I want to at least continue to work if it is.
Hopefully the validation layers can catch this.
| } | ||
|
|
||
| numHandled := 0 | ||
| for len(unhandledPipelines) != 0 { |
There was a problem hiding this comment.
Looks like not optimal? Anyway, we can optimize it later if it matters.
qining
left a comment
There was a problem hiding this comment.
Just had a fast read, Still reading the details of the code...
gapis/api/vulkan/state_rebuilder.go
Outdated
| VkMemoryAllocateInfo{ | ||
| VkStructureType_VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, | ||
| NewVoidᶜᵖ(memory.Nullptr), | ||
| size * 2, // Overallocate by a factor of 2. |
There was a problem hiding this comment.
Any reason for the overallocate?
There was a problem hiding this comment.
Discussed offline.
There was a problem hiding this comment.
Would be nice to be documented in the code. 😉
gapis/api/vulkan/state_rebuilder.go
Outdated
| func (sb *stateBuilder) getSparseQueueFor(lastBoundQueue *QueueObject, device VkDevice, queueFamilyIndices *map[uint32]uint32) *QueueObject { | ||
| hasQueueFamilyIndices := queueFamilyIndices != nil | ||
|
|
||
| queueProperties := sb.s.PhysicalDevices.Get(sb.s.Devices.Get(lastBoundQueue.Device).PhysicalDevice).QueueFamilyProperties |
There was a problem hiding this comment.
I saw lastBoundQueue != nil in the next line. So if it can be nil here, lastBoundQueue.Device will crash.
gapis/api/vulkan/state_rebuilder.go
Outdated
| size, | ||
| }).Ptr(), | ||
| VkResult_VK_SUCCESS, | ||
| ).AddWrite(dat.Data())) |
There was a problem hiding this comment.
This should be AddRead(dat.Data())
ben-clayton
left a comment
There was a problem hiding this comment.
Please address comments in follow up CLs once bazel branch is merged.
gapii/cc/chunk_writer.cpp
Outdated
| void ChunkWriterImpl::flush() { | ||
| mStreamGood = mWriter->write(mBuffer.data(), mBuffer.size()); | ||
| size_t bufferSize = mBuffer.size(); | ||
| // If we flush en empty buffer, this will return false, which is incorrect. |
There was a problem hiding this comment.
Good question - Andrew?
gapii/cc/pool.h
Outdated
| class Pool { | ||
| public: | ||
| static std::shared_ptr<Pool> create(uint32_t id, uint64_t size); | ||
| // This creates a pool that can be serialized, but has no actual |
| : mBase(base), mCount(count), mPool(pool) { | ||
| GAPID_ASSERT(mBase != nullptr || count == 0 /* Slice: null pointer */); | ||
|
|
||
| if (!mPool || !mPool->is_virtual()) { |
There was a problem hiding this comment.
IIRC mPool is nullptr, if this is the application pool. I might be wrong, but I think that is the reasoning for this logic.
gapii/cc/spy.cpp
Outdated
| set_suspended(false); | ||
| saveInitialSate(); | ||
| set_recording_state(true); | ||
| //set_recording_state(true); |
There was a problem hiding this comment.
That should all be cleaned up and gone now. Not sure why it shows in this CR.
| // There is a cycle in the basePipeline indices. | ||
| // Or the no base pipelines does exist. | ||
| // Create the rest without base pipelines | ||
| for k, _ := range unhandledPipelines { |
There was a problem hiding this comment.
Superdooperübernit:
for k := range unhandledPipelines {Is more idiomatic
gapis/api/vulkan/state_rebuilder.go
Outdated
| VkMemoryAllocateInfo{ | ||
| VkStructureType_VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, | ||
| NewVoidᶜᵖ(memory.Nullptr), | ||
| size * 2, // Overallocate by a factor of 2. |
There was a problem hiding this comment.
Would be nice to be documented in the code. 😉
gapis/api/vulkan/state_rebuilder.go
Outdated
| size, | ||
| }).Ptr(), | ||
| VkResult_VK_SUCCESS, | ||
| ).AddWrite(dat.Data())) |
gapis/api/vulkan/state_rebuilder.go
Outdated
| func (sb *stateBuilder) getSparseQueueFor(lastBoundQueue *QueueObject, device VkDevice, queueFamilyIndices *map[uint32]uint32) *QueueObject { | ||
| hasQueueFamilyIndices := queueFamilyIndices != nil | ||
|
|
||
| queueProperties := sb.s.PhysicalDevices.Get(sb.s.Devices.Get(lastBoundQueue.Device).PhysicalDevice).QueueFamilyProperties |
| func (*State) SetupInitialState(ctx context.Context) {} | ||
|
|
||
| func (*State) RebuildState(ctx context.Context, s *api.GlobalState) []api.Cmd { return nil } | ||
| func (c *State) SetupInitialState(ctx context.Context) { |
Instead of passing across synthetic commands, pass across the entire state block. This allows us to more efficiently handle the state block on the server side.
We were accidentally removing all buffer descriptor sets. This was causing replays to fail.
This re-writes the capture so that the state block at the start is replaced with the commands needed to generate the state block.
This will create a virtual command when a subcommand is requested.
Now that we serialize state, we have to let the early-terminator know that is it running with extra commands. This is so that the sync data matches the actual command list.
This will instruct the allocator to not allocate over the memory ranges needed by the initial commands.
This fixes textures in the UI.
Also work around a validation warning in read_framebuffer.go
When we re-create pools we do it through the observations. Therefore add a single 0-byte observation to each pool.
Also, recover the inheritance info of command buffers and bring back the missing layout transition for images that have mutiple samples or not-color aspect.
When the queue submission does not contain any commands, the signaled semaphore label still should be written. And for the wait semaphores, the submission will unsignal the semaphore, so it is a modify to the label, not just a read.
vkQueueSubmit more correct.
non-dedicately allocated handle.
Instead of serializing pseudo-commands for mid-execution capture "eg: RecreateInstance", serialize the state block as-is.
Only re-create the state block when we need to on the server side.
TODO in a future MR: