Skip to content

Pipe validation output to report view#1931

Merged
qining merged 6 commits into
google:masterfrom
qining:pipe-vk-validation-report
Jun 12, 2018
Merged

Pipe validation output to report view#1931
qining merged 6 commits into
google:masterfrom
qining:pipe-vk-validation-report

Conversation

@qining

@qining qining commented May 30, 2018

Copy link
Copy Markdown
Contributor

This CL does not package Vulkan validation layers in GAPID. It only pipes the output validation layers to the report view, if the validation layers are present and can be used to create instance.

For initial commands, their IDs are assigned to 0, and linearized ID
(the label) will be specified in the message.

GAPIS and GAPIR use same Severity level, which is extracted from
gapis/service/service.proto.

Some validation errors relevant to the virtual swapchain are deferred to
next CL to fix

  • vkGetPhysicalDeviceSurfaceFormatsKHR, 'count' arg not match
  • vkGetPhysicalDeviceSurfacePresentModesKHR, 'count' arg not match
  • vkCreateSwapChainKHR, 'imageFormat' does not match with 'colorSpace' member

@qining qining requested review from AWoloszyn and ben-clayton May 30, 2018 11:56
Comment thread gapis/api/vulkan/find_issues.go Outdated
// TODO: For MEC, we need to minus the number of initial commands
// TODO: Figure out what to do for commands inserted by GAPID, whose label is ~0.
issue.Command = api.CmdID(n.GetLabel())
issue.Severity = service.Severity(uint32(n.GetSeverity()))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do we have a better way to enforce this? I found in gapis/service/service.proto, and core/log, we also just note in the comments to say their value should be the same.

}
pInfo->enabledLayerCount = layer_count;
if (!has_debug_report && addValidationLayer) {
exts[ext_count++] = debugReportName;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

VK_EXT_debug_report is an instance extension so we should not enable it for device. This code is just added here to test the fallback route. Will be removed later in this PR.

@qining qining force-pushed the pipe-vk-validation-report branch 2 times, most recently from 7df78e1 to 86d1a89 Compare June 2, 2018 03:31
@qining qining changed the title WIP: Pipe validation output to report view Pipe validation output to report view Jun 2, 2018
@qining qining requested a review from pmuetschard June 4, 2018 14:50
Comment thread core/log/log_pb/BUILD.bazel Outdated
visibility = ["//visibility:public"],
deps = [":log_pb_proto"],
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not used, remove this.


pSurfaceCapabilities->supportedUsageFlags =
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AWoloszyn . Seems like we should have this usage bit set for the images created in our virtual swapchain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, that is fair, although PROBABLY should be another CL.

Comment thread gapir/cc/context.h Outdated
std::unique_ptr<Interpreter> mInterpreter;

// total number of notifications issued by this context
uint64_t mNumNotifications;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Change to:

// The total number of debug messages sent to GAPIS by this context.
uint64_t mNumSentDebugMessages

return mockedSendPostData(posts.get());
}
// TODO: mock sendNotification and test it once it is used.
MOCK_METHOD7(sendNotification,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tests?

Comment thread gapir/cc/vulkan_gfx_api.inc Outdated
@@ -36,11 +36,17 @@ IndirectMaps mIndirectMaps;

// Function for wrapping around the normal vkCreateInstance to inject
// virtual swapchain as an additional enabled layer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update blurbs to take validation layer/debug report extension into account.

debugReportExtension = "VK_EXT_debug_report"
)

func isValidationLayer(n string) bool {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

blurbs

Comment thread gapis/replay/batch.go Outdated
var payload gapir.Payload
var decoder builder.ResponseDecoder
builderBuildTimer.Time(func() { payload, decoder, err = b.Build(ctx) })
var postResp builder.PostDataResponsor

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Responsor? Responser? Receiver? Consumer?

Comment thread gapis/replay/builder/builder.go Outdated
// machine.
type NotificationResponsor func(p *gapir.Notification)

type ReadNotification func(p gapir.Notification)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Blurb

Comment thread gapis/replay/builder/builder.go Outdated
b.ReserveMemory(rng)
}

func (b *Builder) RegisterNotificationReader(reader ReadNotification) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Blurb

else:
_generate_cc(**kwargs)

def cc_grpc_library(name, proto, dep_cc_proto_libs, **kwargs):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cc_grpc_library is overwritten here (together with generate_cc to avoid dependency issue) because the gRPC original one depends on their in-house defined 'intermediate' targets when generating gRPC code for multiple proto files, makes the rule not good for external use, e.g. inferencing the original proto_library target names from proto-generated cpp file group target, but that rule of inference is only followed in gRPC repository.

@qining

qining commented Jun 4, 2018

Copy link
Copy Markdown
Contributor Author

@AWoloszyn This CL is ready for review

@@ -86,12 +88,14 @@ message PostData {
// build time of the replay instruction.
message Notification {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The general rule for protobuf is that you never re-number fields. You only add to the end.
However since we ship the client&server in one package, this won't actually be a problem.

"github.com/google/gapid/gapis/service"
)

var validationLayers = [...]string{

@AWoloszyn AWoloszyn Jun 4, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TIL: [...]

Comment thread gapis/api/vulkan/find_issues.go Outdated
for _, d := range validationLayersData {
newCmd.AddRead(d.Data())
}
newCmd.AddRead(debugReportExtNameData.Data())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think AddRead() returns the cmd.

newCmd.AddRead().AddRead().AddRead()....

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 2b9a068

Comment thread gapis/api/vulkan/find_issues.go Outdated
layersData := s.AllocDataOrPanic(ctx, layers)
info.SetEnabledLayerCount(uint32(len(layers)))
info.SetPpEnabledLayerNames(NewCharᶜᵖᶜᵖ(layersData.Ptr()))
infoData := s.AllocDataOrPanic(ctx, info)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to clean this up somewhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 2b9a068.

Similar to read_framebuffer.go, the memory is cleaned after at the return of find_issue's Transform call. It is one-command later then freeing just after the call to mutate() for vkCreateInstance, because I inserted a vkCreateDebugReportCallbackEXT after it. But I think it should be fine, using defer looks nicer than calling free() manually after each mutate().

Comment thread gapis/api/vulkan/find_issues.go Outdated
info.SetPpEnabledLayerNames(NewCharᶜᵖᶜᵖ(layersData.Ptr()))
info.SetEnabledExtensionCount(uint32(len(exts)))
info.SetPpEnabledExtensionNames(NewCharᶜᵖᶜᵖ(extsData.Ptr()))
infoData := s.AllocDataOrPanic(ctx, info)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have to clean this up somewhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 2b9a068

Comment thread gapis/api/vulkan/find_issues.go Outdated
}
return false
}))
callbackHandleData := s.AllocDataOrPanic(ctx, callbackHandle)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to clean these up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 2b9a068

uint32_t api_index, uint64_t label,
const std::string& msg,
const void* data, uint32_t data_size) {
using severity::Severity;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const Severity logLevels[] = {
   Severity::FatalLevel,
   Severity::ErrorLevel,
   ...
}
if (severity <= LOG_LEVEL_DEBUG) {
   sev = logLevels[severity];
}

Comment thread gapir/cc/replay_connection.h Outdated
virtual bool sendNotification(uint64_t id, uint32_t api_index, uint64_t label,
const std::string& msg, const void* data,
uint32_t data_size);
virtual bool sendNotification(uint64_t id, int severity, uint32_t api_index,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we make severity unsigned? Is there any reason it can ever be negative?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed to uint32_t in c0e75da

alwayslink = alwayslink,
)


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@pmuetschard Can you take a look at this part?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done. Only one minor comment, otherwise looks fine.

Comment thread tools/build/rules/grpc_c++.bzl Outdated
directly.
"""

def generate_cc_impl(ctx):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Names that start with an underscore are considered private. So if you don't want functions to be used outside of this file, name them _foo. This is typically always done for rule implementations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 4caa404

alwayslink = alwayslink,
)


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Done. Only one minor comment, otherwise looks fine.

qining added 6 commits June 11, 2018 10:26
For initial commands, their IDs are assigned to 0, and linearized ID
(the label) will be specified in the message.

GAPIS and GAPIR use same Severity level, which is extracted from
gapis/service/service.proto.

Some validation errors relevant to the virtual swapchain are deferred to
next CL to fix
 - [ ] vkGetPhysicalDeviceSurfaceFormatsKHR, 'count' arg not match
 - [ ] vkGetPhysicalDeviceSurfacePresentModesKHR, 'count' arg not match
 - [ ] vkCreateSwapChainKHR, 'imageFormat' does not match with 'colorSpace' member
@qining qining force-pushed the pipe-vk-validation-report branch from 4caa404 to e638000 Compare June 11, 2018 14:26

@AWoloszyn AWoloszyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please squash before submitting.

@qining qining merged commit a154851 into google:master Jun 12, 2018
@qining qining deleted the pipe-vk-validation-report branch October 23, 2018 17:33
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.

3 participants