Repository navigation
honeykrisp: keep the whole VA window when sparse is unsupported #38
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
base: integration/aurora
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -313,16 +313,21 @@ hk_AllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, | |
| : mem->bo->va->addr; | ||
| } | ||
|
|
||
| /* Shadow map in case this is used for a sparse resident buffer */ | ||
| int ret = agx_bo_bind(&dev->dev, mem->bo, | ||
| agx_rw_addr_to_ro(&dev->dev, mem->bo->va->addr), | ||
| mem->bo->size, 0, DRM_ASAHI_BIND_READ); | ||
| if (ret) { | ||
| /* The bind fails once the VM carries a sticky error. */ | ||
| agx_bo_unreference(&dev->dev, mem->bo); | ||
| mem->bo = NULL; | ||
| vk_device_memory_destroy(&dev->vk, pAllocator, &mem->vk); | ||
| return vk_error(dev, VK_ERROR_OUT_OF_DEVICE_MEMORY); | ||
| /* Shadow map in case this is used for a sparse resident buffer. Skipped | ||
| * while sparse is unsupported: with sparse_ro_offset == 0 the shadow | ||
| * address equals the primary mapping, so binding it twice only doubles | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This bind never drew from — Marcelo's agent |
||
| * the per-allocation bind cost and halves the usable heap budget. */ | ||
| if (dev->dev.sparse_ro_offset) { | ||
| int ret = agx_bo_bind(&dev->dev, mem->bo, | ||
| agx_rw_addr_to_ro(&dev->dev, mem->bo->va->addr), | ||
| mem->bo->size, 0, DRM_ASAHI_BIND_READ); | ||
| if (ret) { | ||
| /* The bind fails once the VM carries a sticky error. */ | ||
| agx_bo_unreference(&dev->dev, mem->bo); | ||
| mem->bo = NULL; | ||
| vk_device_memory_destroy(&dev->vk, pAllocator, &mem->vk); | ||
| return vk_error(dev, VK_ERROR_OUT_OF_DEVICE_MEMORY); | ||
| } | ||
| } | ||
|
|
||
| if (mem->bo->flags & (AGX_BO_SHAREABLE | AGX_BO_SHARED)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -327,6 +327,11 @@ hk_get_device_features( | |
| const struct vk_device_extension_table *supported_extensions, | ||
| struct vk_features *features) | ||
| { | ||
| /* The read-only sparse alias exists only while sparse_ro_offset is set. | ||
| * Without it an unbound sparse page maps the shared writable scratch BO, | ||
| * so non-resident-strict reads cannot hold; do not advertise sparse. */ | ||
| const bool sparse_usable = dev->sparse_ro_offset != 0; | ||
|
|
||
| *features = (struct vk_features){ | ||
| /* Vulkan 1.0 */ | ||
| .robustBufferAccess = true, | ||
|
|
@@ -384,19 +389,19 @@ hk_get_device_features( | |
| .shaderFloat64 = false, | ||
| .shaderInt64 = true, | ||
| .shaderInt16 = true, | ||
| .shaderResourceResidency = true, | ||
| .shaderResourceResidency = sparse_usable, | ||
| .shaderResourceMinLod = true, | ||
| .sparseBinding = true, | ||
| .sparseBinding = sparse_usable, | ||
|
|
||
| /* We probably could advertise multisampled sparse but we don't have a use | ||
| * case yet and it isn't trivial. | ||
| */ | ||
| .sparseResidency2Samples = false, | ||
| .sparseResidency4Samples = false, | ||
| .sparseResidency8Samples = false, | ||
| .sparseResidencyAliased = true, | ||
| .sparseResidencyImage2D = true, | ||
| .sparseResidencyBuffer = true, | ||
| .sparseResidencyAliased = sparse_usable, | ||
| .sparseResidencyImage2D = sparse_usable, | ||
| .sparseResidencyBuffer = sparse_usable, | ||
|
|
||
| /* This needs investigation. */ | ||
| .sparseResidencyImage3D = false, | ||
|
|
@@ -933,7 +938,8 @@ hk_get_device_features( | |
| * window is split for the RO alias exactly as AGX2 is. Sparse texture | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the window is no longer split for the RO alias, so this rationale is stale. — Marcelo's agent |
||
| * updates flush the SSTT with a HAL200 CDM record, so other native | ||
| * chips do not advertise it. */ | ||
| const bool sparse = dev->chip == AGX_CHIP_G17P; | ||
| const bool sparse = dev->chip == AGX_CHIP_G17P && | ||
| dev->sparse_ro_offset != 0; | ||
| features->shaderResourceResidency = sparse; | ||
| features->sparseBinding = sparse; | ||
| features->sparseResidencyAliased = false; | ||
|
|
@@ -1300,7 +1306,7 @@ hk_get_device_properties(const struct agx_device *dev, | |
| .nonCoherentAtomSize = 64, | ||
|
|
||
| /* Vulkan 1.0 sparse properties */ | ||
| .sparseResidencyNonResidentStrict = true, | ||
| .sparseResidencyNonResidentStrict = dev->sparse_ro_offset != 0, | ||
| .sparseResidencyAlignedMipSize = false, | ||
| .sparseResidencyStandard2DBlockShape = true, | ||
|
|
||
|
|
@@ -2097,8 +2103,9 @@ hk_create_drm_physical_device(struct vk_instance *_instance, | |
| assert(pdev->mem_type_count <= ARRAY_SIZE(pdev->mem_types)); | ||
|
|
||
| VkQueueFlags queue_flags = | ||
| VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT | | ||
| VK_QUEUE_SPARSE_BINDING_BIT; | ||
| VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT | VK_QUEUE_TRANSFER_BIT; | ||
| if (pdev->vk.supported_features.sparseBinding) | ||
| queue_flags |= VK_QUEUE_SPARSE_BINDING_BIT; | ||
| if (agx_native_graphics(&pdev->dev)) { | ||
| /* Graphics, compute and transfers use the native HAL200 queue path. | ||
| * Sparse binding rides the shared per-page VM_BIND path; advertise it | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is shared with GL, so "Honeykrisp refuses" undersells the scope. The capture-replay sentence can go, since those buffers aren't sparse.
— Marcelo's agent