1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
#!/usr/bin/env python
# SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
import nsysstats
class DX12MemOp(nsysstats.ExpertSystemsReport):
display_name = 'DEPRECATED - Use dx12_mem_ops instead'
usage = '{SCRIPT} -- {{DISPLAY_NAME}}'
should_display = False
message_advice = ("The following are host-side memory operations that can"
" be blocking and result in stuttering.")
message_advice_extended = (message_advice + "\n\nFor more information on"
" each warning, use the option '--help-rules={SCRIPT}'.")
message_noresult = ("There were no problems detected related to"
" memory operations.")
query_mem_op = """
SELECT
api.end - api.start AS "Duration:dur_ns",
api.start AS "Start:ts_ns",
api.globalTid & 0x00FFFFFF AS "TID",
memop.gpu AS "Device ID",
CASE
WHEN sid.value LIKE 'ID3D12Device::CreateHeap%'
AND memop.heapFlags & 0x1000 == 0
THEN 'D3D12_HEAP_CREATED_WITH_ZEROING'
WHEN sid.value LIKE 'ID3D12Device::CreateCommittedResource%'
AND memop.heapFlags & 0x1000 == 0
THEN 'D3D12_COMMITTED_RESOURCE_CREATED_WITH_ZEROING'
WHEN sid.value == 'ID3D12Resource::ReadFromSubresource'
AND memop.heapType == 1
THEN 'D3D12_READ_FROM_UPLOAD_HEAP_SUBRESOURCE'
WHEN sid.value == 'ID3D12Resource::ReadFromSubresource'
AND memop.cpuPageProperty == 2
THEN 'D3D12_READ_FROM_SUBRESOURCE_TO_WRITE_COMBINE_PAGE'
WHEN sid.value == 'ID3D12Resource::WriteToSubresource'
AND memop.heapType == 2
THEN 'D3D12_WRITE_TO_READBACK_HEAP_SUBRESOURCE'
WHEN sid.value == 'ID3D12Resource::WriteToSubresource'
AND memop.cpuPageProperty == 3
THEN 'D3D12_WRITE_TO_SUBRESOURCE_FROM_WRITE_BACK_PAGE'
ELSE NULL
END AS "Warning Type",
api.globalTid AS "_Global ID",
memop.heapType AS "_Heap Type",
'dx12' AS "_API"
FROM
DX12_MEMORY_OPERATION AS memop
JOIN
DX12_API AS api
ON api.id == memop.traceEventId
JOIN
StringIds AS sid
ON sid.id == api.nameId
WHERE
"Warning Type" IS NOT NULL
ORDER BY
1 DESC
LIMIT {ROW_LIMIT}
"""
table_checks = {
'DX12_API':
"{DBFILE} could not be analyzed because it does not contain the required DX12 data."
" Does the application use DX12 APIs?",
'DX12_MEMORY_OPERATION':
"{DBFILE} could not be analyzed because it does not contain the required DX12 data."
" Does the application perform DX12 memory operations?"
}
def setup(self):
err = super().setup()
if err != None:
return err
self.query = self.query_mem_op.format(
ROW_LIMIT = self._row_limit)
if __name__ == "__main__":
DX12MemOp.Main()
|