estimateLiveBatchMemoryUsage estimate the GPU memory usage for live batches
(batch *memstore.LiveBatch)
| 1038 | |
| 1039 | // estimateLiveBatchMemoryUsage estimate the GPU memory usage for live batches |
| 1040 | func (qc *AQLQueryContext) estimateLiveBatchMemoryUsage(batch *memstore.LiveBatch) int { |
| 1041 | columnMemUsage := 0 |
| 1042 | for _, columnID := range qc.TableScanners[0].Columns { |
| 1043 | sourceVP := batch.Columns[columnID] |
| 1044 | if sourceVP == nil { |
| 1045 | continue |
| 1046 | } |
| 1047 | columnMemUsage += int(sourceVP.GetBytes()) |
| 1048 | } |
| 1049 | if batch.Capacity > qc.maxBatchSizeAfterPrefilter { |
| 1050 | qc.maxBatchSizeAfterPrefilter = batch.Capacity |
| 1051 | } |
| 1052 | totalBytes := qc.estimateMemUsageForBatch(batch.Capacity, columnMemUsage, batch.Capacity) |
| 1053 | utils.GetQueryLogger().Debugf("Live batch %+v needs memory: %d", batch, totalBytes) |
| 1054 | return totalBytes |
| 1055 | } |
| 1056 | |
| 1057 | // estimateArchiveBatchMemoryUsage estimate the GPU memory usage for archive batch |
| 1058 | func (qc *AQLQueryContext) estimateArchiveBatchMemoryUsage(batch *memstore.ArchiveBatch, isFirstOrLast bool) int { |
no test coverage detected