Commit 579972e
committed
test: split model loading into phases for measurement
This test separates model loading into two distinct phases:
1. Reading the model from disk and converting data types
(stored in RAM).
2. Loading tensors into VRAM (device memory).
This allows more precise measurement of how much time
each phase contributes to the overall loading time.
The results appear as additional log lines in the output:
[INFO ] model.cpp:1882 - SD_TEST_POSTPONE_DEVICE_LOADING=2
|==================================================| 2641/2641 - 822.49it/s
[INFO ] model.cpp:2107 - loaded 0 tensors to device memory in 3.211ms (phase 1)
|==================================================| 2533/2533 - 572.43it/s
[INFO ] model.cpp:2127 - loaded 2533 tensors to device memory in 4.425ms (phase 2)
The behavior is controlled by the environment variable
SD_TEST_POSTPONE_DEVICE_LOADING:
- 0: original behavior: only counts tensors loaded to device.
- 1: defer loading of tensors whose stored type doesn't match
the device type (typically smaller and more numerous).
- 2: load all tensors from disk into RAM first, then transfer
them to VRAM in phase 2 (full separation).
Note: Splitting the loading process into phases demands enough
RAM to store all converted weights, and will likely increase
total loading time.1 parent 2eb3845 commit 579972e
1 file changed
+56
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1872 | 1872 | | |
1873 | 1873 | | |
1874 | 1874 | | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
1875 | 1885 | | |
1876 | 1886 | | |
1877 | 1887 | | |
| |||
1942 | 1952 | | |
1943 | 1953 | | |
1944 | 1954 | | |
| 1955 | + | |
1945 | 1956 | | |
1946 | 1957 | | |
1947 | 1958 | | |
1948 | 1959 | | |
1949 | 1960 | | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
1950 | 1964 | | |
1951 | 1965 | | |
1952 | 1966 | | |
| |||
2038 | 2052 | | |
2039 | 2053 | | |
2040 | 2054 | | |
2041 | | - | |
2042 | | - | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
2043 | 2063 | | |
2044 | 2064 | | |
2045 | 2065 | | |
2046 | 2066 | | |
2047 | 2067 | | |
2048 | 2068 | | |
2049 | | - | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
2050 | 2076 | | |
2051 | 2077 | | |
2052 | 2078 | | |
| |||
2075 | 2101 | | |
2076 | 2102 | | |
2077 | 2103 | | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2078 | 2131 | | |
2079 | 2132 | | |
2080 | 2133 | | |
| |||
0 commit comments