@@ -12,6 +12,7 @@ struct FFIgclData {
1212 FF_LIBRARY_SYMBOL (ctlEnumTemperatureSensors )
1313 FF_LIBRARY_SYMBOL (ctlTemperatureGetState )
1414 FF_LIBRARY_SYMBOL (ctlEnumMemoryModules )
15+ FF_LIBRARY_SYMBOL (ctlMemoryGetProperties )
1516 FF_LIBRARY_SYMBOL (ctlMemoryGetState )
1617 FF_LIBRARY_SYMBOL (ctlEnumFrequencyDomains )
1718 FF_LIBRARY_SYMBOL (ctlFrequencyGetProperties )
@@ -42,6 +43,7 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
4243 FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlEnumTemperatureSensors )
4344 FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlTemperatureGetState )
4445 FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlEnumMemoryModules )
46+ FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlMemoryGetProperties )
4547 FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlMemoryGetState )
4648 FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlEnumFrequencyDomains )
4749 FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE (libigcl , igclData , ctlFrequencyGetProperties )
@@ -135,14 +137,56 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
135137 result .memory -> total = 0 ;
136138 for (uint32_t iMem = 0 ; iMem < memoryCount ; iMem ++ )
137139 {
138- ctl_mem_state_t memoryState = {
139- .Size = sizeof (ctl_mem_state_t ),
140+ ctl_mem_properties_t memoryProperties = {
141+ .Size = sizeof (memoryProperties ),
140142 .Version = 0 ,
141143 };
142- if (igclData .ffctlMemoryGetState (memoryModules [iMem ], & memoryState ) == CTL_RESULT_SUCCESS )
144+ if (igclData .ffctlMemoryGetProperties (memoryModules [iMem ], & memoryProperties ) == CTL_RESULT_SUCCESS )
143145 {
144- result .memory -> total += memoryState .size ;
145- result .memory -> used += memoryState .size - memoryState .free ;
146+ if (memoryProperties .location == CTL_MEM_LOC_DEVICE && result .memoryType )
147+ {
148+ switch (memoryProperties .type )
149+ {
150+ #define FF_ICTL_MEM_TYPE_CASE (type ) case CTL_MEM_TYPE_##type: ffStrbufSetStatic(result.memoryType, #type); break
151+ FF_ICTL_MEM_TYPE_CASE (HBM );
152+ FF_ICTL_MEM_TYPE_CASE (DDR );
153+ FF_ICTL_MEM_TYPE_CASE (DDR3 );
154+ FF_ICTL_MEM_TYPE_CASE (DDR4 );
155+ FF_ICTL_MEM_TYPE_CASE (DDR5 );
156+ FF_ICTL_MEM_TYPE_CASE (LPDDR );
157+ FF_ICTL_MEM_TYPE_CASE (LPDDR3 );
158+ FF_ICTL_MEM_TYPE_CASE (LPDDR4 );
159+ FF_ICTL_MEM_TYPE_CASE (LPDDR5 );
160+ FF_ICTL_MEM_TYPE_CASE (GDDR4 );
161+ FF_ICTL_MEM_TYPE_CASE (GDDR5 );
162+ FF_ICTL_MEM_TYPE_CASE (GDDR5X );
163+ FF_ICTL_MEM_TYPE_CASE (GDDR6 );
164+ FF_ICTL_MEM_TYPE_CASE (GDDR6X );
165+ FF_ICTL_MEM_TYPE_CASE (GDDR7 );
166+ #undef FF_ICTL_MEM_TYPE_CASE
167+ default :
168+ ffStrbufSetF (result .memoryType , "Unknown (%u)" , memoryProperties .type );
169+ break ;
170+ }
171+ }
172+
173+ ctl_mem_state_t memoryState = {
174+ .Size = sizeof (ctl_mem_state_t ),
175+ .Version = 0 ,
176+ };
177+ if (igclData .ffctlMemoryGetState (memoryModules [iMem ], & memoryState ) == CTL_RESULT_SUCCESS )
178+ {
179+ if (memoryProperties .location == CTL_MEM_LOC_DEVICE )
180+ {
181+ result .memory -> total += memoryState .size ;
182+ result .memory -> used += memoryState .size - memoryState .free ;
183+ }
184+ else if (result .sharedMemory && memoryProperties .location == CTL_MEM_LOC_SYSTEM )
185+ {
186+ result .sharedMemory -> total += memoryState .size ;
187+ result .sharedMemory -> used += memoryState .size - memoryState .free ;
188+ }
189+ }
146190 }
147191 }
148192 }
0 commit comments