Using debugPrintfEXT in Vulkan - glsl

I'm trying to figure out how to use debugPrintfEXT but with no luck.
First I've enabled the extension in my vertex shader
#version 450
#extension GL_EXT_debug_printf : enable
void main()
{
debugPrintfEXT("Test");
// ... some more stuff here ...
}
Then I specify the necessary extensions for the Vulkan instance
VkValidationFeatureEnableEXT enables[] = {VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT};
VkValidationFeaturesEXT features = {};
features.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
features.enabledValidationFeatureCount = 1;
features.pEnabledValidationFeatures = enables;
VkInstanceCreateInfo info = {};
info.pNext = &features;
In the info.ppEnabledExtensionNames field I specified VK_EXT_validation_features and VK_EXT_debug_utils among other things.
When I run my app, I get the following logs
VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x79de34d4 | vkCreateDebugUtilsMessengerEXT: value of pCreateInfo->pNext must be NULL. This error is based on the Valid Usage documentation for version 182 of the Vulkan header. It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pCreateInfo->pNext is undefined and may not work correctly with validation enabled
Objects: 1
[0] 0, type: 3, name: NULL
[Debug][Error][Validation]"Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-04147 ] Object 0: handle = 0x5651b647e828, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x3d492883 | vkCreateShaderModule(): The SPIR-V Extension (SPV_KHR_non_semantic_info) was declared, but none of the requirements were met to use it. The Vulkan spec states: If pCode declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://vulkan.lunarg.com/doc/view/1.2.182.0/linux/1.2-extensions/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-04147)"
What more should I do? And what does
one of the corresponding requirements must be satisfied
mean? Is there something that I'm missing?
Edit:
As suggested by Karl Schultz, it's necessary to add VK_KHR_shader_non_semantic_info to info.ppEnabledExtensionNames.
Also, make sure to set log level to INFO with VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT in VkDebugUtilsMessengerCreateInfoEXT::messageSeverity. By default all the output produced by debugPrintfEXT has INFO level.
You may also see
Printf message was truncated, likely due to a buffer size that was too small for the message
if you spawn too many threads, each printing its own long logs.

You also need to enable the VK_KHR_shader_non_semantic_info device extension in your application code when you create the device.
LunarG has also recently published a white paper about debugPrintfEXT.

Related

Making complex Terraform output optional?

I have an unenviable situation where I have to pass some unnecessary information into a module to make one thing (a Private Hosted R53 Zone), but not a bunch of others.
tl;dr, I'm trying to suppress outputs. If I didn't need to expose this output, my plan would behave as I expect. Outputs that produce strings or tuples were fine with me using the same condition to decide whether or not they would be evaluated, but the one below is still evaluating the attributes of the object:
output endpoint_dns_entries {
value = contains(local.de_dupe_phz_names, var.service["phz_name"]) ? {empty = [""]
emptyalso = [""]} : {
dns_names = aws_vpc_endpoint.endpoint.*.dns_entry[*].dns_name
hosted_zone_ids = aws_vpc_endpoint.endpoint.*.dns_entry[*].hosted_zone_id
}
}
yields errors:
Error: Unsupported attribute
on ../../endpoint-with-phz/outputs.tf line 12, in output "endpoint_dns_entries":
12: dns_names = aws_vpc_endpoint.endpoint.*.dns_entry[*].dns_name
This value does not have any attributes.
Error: Unsupported attribute
on ../../endpoint-with-phz/outputs.tf line 13, in output "endpoint_dns_entries":
13: hosted_zone_ids = aws_vpc_endpoint.endpoint.*.dns_entry[*].hosted_zone_id
This value does not have any attributes.
Any ideas on how to make this output optional?

Retrieving sensitive data from secret version in terraform

When showing the state of the secret version, just get shown this:
terraform state show aws_secretsmanager_secret_version.mysecret
secret_string = (sensitive value)
I want now to see, what the acctual value is, but i do not know how to do it. I have and saw answers like "use terraform output", but when using this:
terraform output aws_secretsmanager_secret_version.mysecret
I get:
The state file either has no outputs defined, or all the defined outputs are empty.
Can anyone help with this, please?
This is by design and for very good reason. Generally, console output will always mask sensitive data from being displayed. The output command you mentioned is only helpful if you have defined an output block that would display this resource or attribute. However, all is not lost. You can either look directly in the state file since the state file will hold the value in plain text. Or you can use terraform console command which is my preference since I prefer where possible to not touch the state file.
CDoyle#MINGW64 ~/PycharmProjects/stack
$ terraform state show random_password.this
# random_password.this:
resource "random_password" "this" {
bcrypt_hash = (sensitive value)
id = "none"
length = 10
lower = true
min_lower = 0
min_numeric = 0
min_special = 0
min_upper = 0
number = true
numeric = true
result = (sensitive value)
special = true
upper = true
}
CDoyle#MINGW64 ~/PycharmProjects/stack
$ terraform console
> nonsensitive(random_password.this.result)
"I]-q*DCL+&"

Couldn't find VkNonDispatchableHandle

I'm using Vulkan to create a simple program. After I resize the window, the validation layer gives me this output. The resize itself works fine. What does it say? The complete error is following:
UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 1567320034 - Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0xee3a9100000000b4, type = VK_OBJECT_TYPE_UNKNOWN; | MessageID = 0x5d6b67e2 | Couldn't find VkNonDispatchableHandle Object 0xee3a9100000000b4. This should not happen and may indicate a bug in the application.
Objects: 1
[0] 0xee3a9100000000b4, type: 0, name: NULL
What causes the problem?
I fixed it up.
The reason, that caused the Problem was, that I tried to destroy a Swapchain which was set to VK_NULL_HANDLE.

terraform giving error: unsupported argument in module when running terraform plan?

I am getting the Error: Unsupported argument, when I run terraform plan in version 12.24.
Error: Unsupported argument
on .terraform/modules/app/main.tf line 261, in resource "aws_db_instance" "db_instance":
261: timeouts = {
An argument named "timeouts" is not expected here. Did you mean to define a
block of type "timeouts"?
This is the code in tf file:
timeouts = {
create = "${var.db_instance_create_timeout}"
update = "${var.db_instance_update_timeout}"
delete = "${var.db_instance_delete_timeout}"
}
I am not sure how to fix this error.
above error was fixed by removing "=" after timeouts.
I am also getting more errors, that need solutions:
Error: Unsupported argument
on .terraform/modules/rds/main.tf line 150, in resource "aws_db_parameter_group" "db_parameter_group":
150: parameter = concat(var.parameters, local.parameters[local.parameter_lookup])
An argument named "parameter" is not expected here. Did you mean to define a
block of type "parameter"?
Code in tf file:
parameter = concat(var.parameters, local.parameters[local.parameter_lookup])
how to fix this?
I am copying the solution that worked for me from github , credits to hashicorp member bflad :
In Terraform 0.12 (or higher), the configuration language parser is stricter about the distinction between arguments and configuration blocks. This error:
An argument named "XXX" is not expected here. Did you mean to
define a block of type "XXX"?
Generally means the = (equals sign) needs to be removed from an argument assignment so it parses correctly as a configuration block, e.g.
root_block_device {
This distinction in HCL syntax may seem trivial, but under the hood this stricter type checking allowed for consistency with JSON syntax. More information about this change can be found in the Terraform 0.12 Upgrade Guide. Speaking of which, in that guide it does point to the helpful terraform 0.12upgrade command, which should automatically fix issues like these across your Terraform configurations when upgrading from Terraform 0.11. 👍
Error
An argument named "secret_environment_variables" is not expected here.
Did you mean to define a block of type "secret_environment_variables"?
Problem
main.tf
resource "google_cloudfunctions_function" "this" {
secret_environment_variables = var.secret_environment_variables
}
variables.tf
variable "secret_environment_variables" {
type = any
default = {}
description = "Secret environment variables configuration."
}
Solution
resource "google_cloudfunctions_function" "this" {
secret_environment_variables {
key = var.secret_environment_variables_key
secret = var.secret_environment_variables_secret
version = var.secret_environment_variables_version
}
}
variable "secret_environment_variables_key" {
type = string
default = null
nullable = true
description = "Name of the environment variable."
}
variable "secret_environment_variables_secret" {
type = string
default = null
nullable = true
description = "ID of the secret in secret manager (not the full resource name)."
}
variable "secret_environment_variables_version" {
type = string
default = null
nullable = true
description = "Version of the secret (version number or the string `latest`). It is recommended to use a numeric version for secret environment variables as any updates to the secret value is not reflected until new clones start."
}

LLVM how to set Attributes::NoUnwind to Function?

I think this is very simple question, but I can't resolve it. Very sad.
So. When I do
llc.exe -march=cpp test.bc
I get interesting test.cpp with this piece of code:
AttrListPtr func__Z2f1i_PAL;
{
SmallVector<AttributeWithIndex, 4> Attrs;
AttributeWithIndex PAWI;
PAWI.Index = 4294967295U; PAWI.Attrs = Attribute::None | Attribute::NoUnwind;
Attrs.push_back(PAWI);
func__Z2f1i_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
}
But when I want to write string like PAWI.Attrs = Attribute::None | Attribute::NoUnwind;
in my project, I got error IntelliSense: no operator "=" matches these operands operand types are: llvm::Attributes = int What I need to do?
All necessary headers included. [OS - Windows 7 x64, LLVM - 3.2]
I don't know why the cpp backend generates this code. In any case attribute handing was changed in 3.2 (and will change again in 3.3). The proper way to get an attribute in 3.2 should be:
Attributes::get(Context, Attributes::NoUnwind)
(you can always pass any ArrayRef here as the second argument, to initialize the attribute set with multiple values).
The simplest way to add an attribute to a function would be:
Function->addFnAttr(Attributes::NoUnwind)
And if you want an AttributeWithIndex:
AttributeWithIndex::get(Context, ID, Attributes::NoUnwind)
// OR:
AttributeWithIndex::get(ID, Attributes::get(Context, Attributes::NoUnwind))