xref: /linux/Documentation/gpu/amdgpu/ptl.rst (revision aa86e750d0ff79c179772b9d3a95375c02a7d191)
1=======================================
2Peak Tops Limiter (PTL) sysfs Interface
3=======================================
4
5Overview
6--------
7The Peak Tops Limiter (PTL) sysfs interface enables users to control and
8configure the PTL feature for each GPU individually.  All PTL-related
9sysfs files are located under `/sys/class/drm/cardX/device/ptl/`, where
10`X` is the GPU index.  Through these files, users can enable or disable
11PTL, set preferred data formats, and query supported formats for each GPU.
12
13PTL sysfs files
14----------------
15The following files are available under `/sys/class/drm/cardX/device/ptl/`:
16
17- `ptl_enable`
18- `ptl_format`
19- `ptl_supported_formats`
20
21PTL Enable/Disable
22------------------
23File: `ptl_enable`
24Type: Read/Write (rw)
25
26Read: Returns the current PTL status as a string: `enabled` if PTL
27is active, or `disabled` if inactive.
28
29Write:
30
31- Write `1` or `enabled` to enable PTL
32- Write `0` or `disabled` to disable PTL
33
34Examples::
35
36    # Query PTL status
37    cat /sys/class/drm/card1/device/ptl/ptl_enable
38    # Output: enabled
39
40    # Enable PTL
41    sudo bash -c "echo 1 > /sys/class/drm/card1/device/ptl/ptl_enable"
42
43    # Disable PTL
44    sudo bash -c "echo 0 > /sys/class/drm/card1/device/ptl/ptl_enable"
45
46PTL Format (Preferred Data Formats)
47-----------------------------------
48File: `ptl_format`
49Type: Read/Write (rw)
50
51Read: Returns the two preferred formats, e.g. `I8,F32`.
52
53Write: Accepts two formats separated by a comma, e.g. `I8,F32`.
54
55- Both formats must be supported and different.
56- If an invalid format is provided (not supported, or both formats are the
57  same), the driver will return "write error: Invalid argument".
58
59Examples::
60
61    # Query PTL formats
62    cat /sys/class/drm/card1/device/ptl/ptl_format
63    # Output: I8,F32
64
65    # Set PTL formats
66    sudo bash -c "echo I8,F32 > /sys/class/drm/card1/device/ptl/ptl_format"
67
68Supported Formats
69-----------------
70File: `ptl_supported_formats`
71Type: Read-only (r)
72
73Read: Returns a comma-separated list of supported formats, e.g.
74`I8,F16,BF16,F32,F64`.
75
76Example::
77
78    # Check supported formats
79    cat /sys/class/drm/card1/device/ptl/ptl_supported_formats
80    # Output: I8,F16,BF16,F32,F64
81
82Behavioral Notes
83----------------
84- PTL formats can only be set when PTL is enabled.
85- If PTL is disabled, `ptl_format` returns `N/A`.
86- Only two formats can be set at a time, and they must be from the supported set and different..
87- All commands support per-GPU targeting.
88- Root permission is required to enable/disable PTL or change formats.
89- If the hardware does not support PTL, the PTL sysfs directory will not
90  be created.
91
92Implementation
93--------------
94The PTL sysfs nodes are implemented in `drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c`.
95