Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions eight_bit_int_gemm/eight_bit_int_gemm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Scratch {
public:
Scratch() : buffer_(), buffer_32_(nullptr), size_(0) {}

void AssureSize(std::int32_t required_size) {
void AssureSize(std::size_t required_size) {
if (size_ >= required_size) {
return;
}
Expand All @@ -167,7 +167,7 @@ class Scratch {
private:
std::unique_ptr<std::uint8_t[]> buffer_;
std::uint8_t* buffer_32_;
std::int32_t size_;
std::size_t size_;
};

Scratch* global_scratch = nullptr;
Expand Down Expand Up @@ -356,9 +356,11 @@ void EightBitIntGemm(bool transpose_a, bool transpose_b, bool transpose_c,
// TODO(maciekc): implement a float output stage, get rid of scratch memory.
Scratch* scratch = GetOrCreateGlobalScratch();
if (transpose_c) {
scratch->AssureSize(m * ldc * sizeof(std::int32_t));
scratch->AssureSize(static_cast<std::size_t>(m) * ldc *
sizeof(std::int32_t));
} else {
scratch->AssureSize(n * ldc * sizeof(std::int32_t));
scratch->AssureSize(static_cast<std::size_t>(n) * ldc *
sizeof(std::int32_t));
}
std::int32_t* temp_c = reinterpret_cast<std::int32_t*>(scratch->buffer());

Expand Down
3 changes: 2 additions & 1 deletion internal/pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class PackedSideBlock {
: allocator_(allocator), pos_(0) {
GetSideBlockParams(side, &params_, block_params);
data_handle_ =
allocator_->Reserve<std::uint8_t>(params_.l2_width * params_.l2_depth);
allocator_->Reserve<std::uint8_t>(
static_cast<std::size_t>(params_.l2_width) * params_.l2_depth);
sums_of_each_slice_handle_ =
allocator_->Reserve<std::int32_t>(params_.l2_width);
}
Expand Down
5 changes: 3 additions & 2 deletions internal/unpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ class PackedResult {
public:
PackedResult(Allocator* _allocator, const BlockParams& _block_params)
: allocator_(_allocator), block_params_(_block_params) {
matrix_handle_ = allocator_->Reserve<std::int32_t>(block_params_.l2_rows *
block_params_.l2_cols);
matrix_handle_ = allocator_->Reserve<std::int32_t>(
static_cast<std::size_t>(block_params_.l2_rows) *
block_params_.l2_cols);
}

~PackedResult() {}
Expand Down