//===----------------------------------------------------------------------===// // Here, we discover the layout of every column that will be accessed. A // column's layout includes three pieces of information: // // 1. The starting memory address (where the first value of the column is) // 2. The stride length // 3. Whether the column is in columnar layout //===----------------------------------------------------------------------===// std::vector<TileGroup::ColumnLayout> TileGroup::GetColumnLayouts( CodeGen &codegen, llvm::Value *tile_group_ptr, llvm::Value *column_layout_infos) const { // Call RuntimeFunctions::GetTileGroupLayout() uint32_t num_cols = schema_.GetColumnCount(); codegen.Call( RuntimeFunctionsProxy::GetTileGroupLayout, {tile_group_ptr, column_layout_infos, codegen.Const32(num_cols)}); // Collect <start, stride, is_columnar> triplets of all columns std::vector<TileGroup::ColumnLayout> layouts; auto *layout_type = ColumnLayoutInfoProxy::GetType(codegen); for (uint32_t col_id = 0; col_id < num_cols; col_id++) { auto *start = codegen->CreateLoad(codegen->CreateConstInBoundsGEP2_32( layout_type, column_layout_infos, col_id, 0)); auto *stride = codegen->CreateLoad(codegen->CreateConstInBoundsGEP2_32( layout_type, column_layout_infos, col_id, 1)); auto *columnar = codegen->CreateLoad(codegen->CreateConstInBoundsGEP2_32( layout_type, column_layout_infos, col_id, 2)); layouts.push_back(ColumnLayout{col_id, start, stride, columnar}); } return layouts; }
// Pull out the 'start_pos_' instance member from the provided Sorter instance llvm::Value *Sorter::GetStartPosition(CodeGen &codegen, llvm::Value *sorter_ptr) const { auto *sorter_type = SorterProxy::GetType(codegen); return codegen->CreateLoad( codegen->CreateConstInBoundsGEP2_32(sorter_type, sorter_ptr, 0, 0)); }
llvm::Value *Sorter::GetNumberOfStoredTuples(CodeGen &codegen, llvm::Value *sorter_ptr) const { auto *sorter_type = SorterProxy::GetType(codegen); return codegen->CreateLoad( codegen->CreateConstInBoundsGEP2_32(sorter_type, sorter_ptr, 0, 3)); }