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

Pipe validation output to report view #1931

Merged
merged 6 commits into from
Jun 12, 2018

Conversation

Qining
Copy link
Contributor

@Qining Qining commented May 30, 2018

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
// 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
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
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
@@ -51,3 +51,9 @@ java_proto_library(
visibility = ["//visibility:public"],
deps = [":log_pb_proto"],
)

Copy link
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.

@@ -115,7 +115,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
// TODO(awoloszyn): Handle all of the composite types.

pSurfaceCapabilities->supportedUsageFlags =
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
Copy link
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
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.

@@ -134,6 +134,9 @@ class Context : private Renderer::Listener {
// The currently running interpreter.
// Only valid for the duration of interpret()
std::unique_ptr<Interpreter> mInterpreter;

// total number of notifications issued by this context
uint64_t mNumNotifications;
Copy link
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

@@ -41,6 +41,9 @@ class MockReplayConnection : public ReplayConnection {
return mockedSendPostData(posts.get());
}
// TODO: mock sendNotification and test it once it is used.
MOCK_METHOD7(sendNotification,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests?

@@ -36,11 +36,17 @@ IndirectMaps mIndirectMaps;

// Function for wrapping around the normal vkCreateInstance to inject
// virtual swapchain as an additional enabled layer.
Copy link
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
Contributor Author

Choose a reason for hiding this comment

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

blurbs

@@ -164,8 +164,9 @@ func (m *Manager) execute(
}

var payload gapir.Payload
var decoder builder.ResponseDecoder
builderBuildTimer.Time(func() { payload, decoder, err = b.Build(ctx) })
var postResp builder.PostDataResponsor
Copy link
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?

// machine.
type NotificationResponsor func(p *gapir.Notification)

type ReadNotification func(p gapir.Notification)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blurb

@@ -566,10 +573,14 @@ func (b *Builder) Write(rng memory.Range, resourceID id.ID) {
b.ReserveMemory(rng)
}

func (b *Builder) RegisterNotificationReader(reader ReadNotification) {
Copy link
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
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
Copy link
Contributor Author

Qining commented Jun 4, 2018

@AWoloszyn This CL is ready for review

@@ -86,12 +88,14 @@ message PostData {
// build time of the replay instruction.
message Notification {
Copy link
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.

)

var validationLayers = [...]string{
Copy link
Contributor

@AWoloszyn AWoloszyn Jun 4, 2018

Choose a reason for hiding this comment

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

TIL: [...]

for _, d := range validationLayersData {
newCmd.AddRead(d.Data())
}
newCmd.AddRead(debugReportExtNameData.Data())
Copy link
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
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

layersData := s.AllocDataOrPanic(ctx, layers)
info.SetEnabledLayerCount(uint32(len(layers)))
info.SetPpEnabledLayerNames(NewCharᶜᵖᶜᵖ(layersData.Ptr()))
infoData := s.AllocDataOrPanic(ctx, info)
Copy link
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
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().

info.SetPpEnabledLayerNames(NewCharᶜᵖᶜᵖ(layersData.Ptr()))
info.SetEnabledExtensionCount(uint32(len(exts)))
info.SetPpEnabledExtensionNames(NewCharᶜᵖᶜᵖ(extsData.Ptr()))
infoData := s.AllocDataOrPanic(ctx, info)
Copy link
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
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

}
return false
}))
callbackHandleData := s.AllocDataOrPanic(ctx, callbackHandle)
Copy link
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
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

const void* data, uint32_t data_size) {
using severity::Severity;
Copy link
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];
}

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
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
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

@@ -110,6 +110,156 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [],
alwayslink = alwayslink,
)


Copy link
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
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.

directly.
"""

def generate_cc_impl(ctx):
Copy link
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
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

@@ -110,6 +110,156 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [],
alwayslink = alwayslink,
)


Copy link
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
Copy link
Contributor

@AWoloszyn AWoloszyn left a comment

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