returns nullptr if generateBordersOnly
| 2178 | public: |
| 2179 | // returns nullptr if generateBordersOnly |
| 2180 | static TQuantizedDataProviderPtr Do( |
| 2181 | const TQuantizationOptions& options, |
| 2182 | TRawDataProviderPtr rawDataProvider, |
| 2183 | TQuantizedFeaturesInfoPtr quantizedFeaturesInfo, |
| 2184 | bool calcQuantizationAndNanModeOnly, |
| 2185 | TRestorableFastRng64* rand, |
| 2186 | NPar::ILocalExecutor* localExecutor, |
| 2187 | const TInitialBorders& initialBorders = Nothing() |
| 2188 | ) { |
| 2189 | auto& srcObjectsCommonData = rawDataProvider->ObjectsData->CommonData; |
| 2190 | |
| 2191 | auto featuresLayout = InitFeaturesLayoutForQuantizedData( |
| 2192 | *srcObjectsCommonData.FeaturesLayout, |
| 2193 | *quantizedFeaturesInfo->GetFeaturesLayout() |
| 2194 | ); |
| 2195 | |
| 2196 | const bool clearSrcData = rawDataProvider->RefCount() <= 1; |
| 2197 | const bool clearSrcObjectsData = clearSrcData && |
| 2198 | (rawDataProvider->ObjectsData->RefCount() <= 1); |
| 2199 | |
| 2200 | /* |
| 2201 | * If these conditions are satisfied quantized features data is only needed for GPU |
| 2202 | * so it is possible not to store all quantized features bins in CPU RAM |
| 2203 | * but generate these quantized feature bin values from raw feature values on the fly |
| 2204 | * just before copying data to GPU memory. |
| 2205 | * Returned TQuantizedObjectsDataProvider will contain |
| 2206 | * TExternalFloatValuesHolders and TExternalCatValuesHolders in features data holders. |
| 2207 | */ |
| 2208 | const bool storeFeaturesDataAsExternalValuesHolders = false; |
| 2209 | /* Temporarily switch ext columns-off to measure speed |
| 2210 | !clearSrcObjectsData && |
| 2211 | !featuresLayout->GetTextFeatureCount();*/ |
| 2212 | |
| 2213 | TObjectsGroupingPtr objectsGrouping = rawDataProvider->ObjectsGrouping; |
| 2214 | |
| 2215 | TSubsetIndexingForBuildBorders subsetIndexingForBuildBorders = GetSubsetForBuildBorders( |
| 2216 | *srcObjectsCommonData.SubsetIndexing, |
| 2217 | *featuresLayout, |
| 2218 | *quantizedFeaturesInfo, |
| 2219 | srcObjectsCommonData.Order, |
| 2220 | options, |
| 2221 | rand, |
| 2222 | localExecutor |
| 2223 | ); |
| 2224 | |
| 2225 | const bool hasDenseSrcData = rawDataProvider->ObjectsData->HasDenseData(); |
| 2226 | |
| 2227 | TMaybe<TQuantizedBuilderData> data; |
| 2228 | TAtomicSharedPtr<TArraySubsetIndexing<ui32>> subsetIndexing; |
| 2229 | TMaybe<TIncrementalDenseIndexing> incrementalIndexing; |
| 2230 | |
| 2231 | if (!calcQuantizationAndNanModeOnly) { |
| 2232 | data.ConstructInPlace(); |
| 2233 | |
| 2234 | auto flatFeatureCount = featuresLayout->GetExternalFeatureCount(); |
| 2235 | data->ObjectsData.PackedBinaryFeaturesData.FlatFeatureIndexToPackedBinaryIndex.resize( |
| 2236 | flatFeatureCount |
| 2237 | ); |
nothing calls this directly
no test coverage detected