Skip to content

Commit

Permalink
fix sort and memory manager fail
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchengchenghh committed Aug 16, 2024
1 parent ab755e5 commit babe70b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
17 changes: 12 additions & 5 deletions cpp/velox/memory/VeloxMemoryManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ class ListenableArbitrator : public velox::memory::MemoryArbitrator {
ListenableArbitrator(const Config& config, AllocationListener* listener)
: MemoryArbitrator(config),
listener_(listener),
memoryPoolInitialCapacity_(
getConfig<uint64_t>(config.extraConfigs, kMemoryPoolInitialCapacity, kDefaultMemoryPoolInitialCapacity)),
memoryPoolTransferCapacity_(
getConfig<uint64_t>(config.extraConfigs, kMemoryPoolTransferCapacity, kDefaultMemoryPoolTransferCapacity)) {
}
memoryPoolInitialCapacity_(velox::config::toCapacity(
getConfig<std::string>(
config.extraConfigs,
kMemoryPoolInitialCapacity,
std::to_string(kDefaultMemoryPoolInitialCapacity)),
velox::config::CapacityUnit::BYTE)),
memoryPoolTransferCapacity_(velox::config::toCapacity(
getConfig<std::string>(
config.extraConfigs,
kMemoryPoolTransferCapacity,
std::to_string(kDefaultMemoryPoolTransferCapacity)),
velox::config::CapacityUnit::BYTE)) {}
std::string kind() const override {
return kind_;
}
Expand Down
12 changes: 3 additions & 9 deletions cpp/velox/shuffle/GlutenByteStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class GlutenByteInputStream : public ByteInputStream {
GlutenByteInputStream() {}

public:
explicit GlutenByteInputStream(std::vector<ByteRange> ranges) : ranges_{std::move(ranges)} {
explicit GlutenByteInputStream(std::vector<ByteRange> ranges) {
ranges_ = std::move(ranges);
VELOX_CHECK(!ranges_.empty());
current_ = &ranges_[0];
}
Expand All @@ -37,8 +38,7 @@ class GlutenByteInputStream : public ByteInputStream {
GlutenByteInputStream& operator=(const GlutenByteInputStream& other) = delete;

/// Enable move constructor.
GlutenByteInputStream(GlutenByteInputStream&& other) noexcept
: ranges_{std::move(other.ranges_)}, current_{other.current_} {}
GlutenByteInputStream(GlutenByteInputStream&& other) noexcept = delete;

/// Enable move assignment operator.
GlutenByteInputStream& operator=(GlutenByteInputStream&& other) noexcept {
Expand Down Expand Up @@ -249,12 +249,6 @@ class GlutenByteInputStream : public ByteInputStream {
ranges_[0] = range;
current_ = ranges_.data();
}

private:
std::vector<ByteRange> ranges_;

// Pointer to the current element of 'ranges_'.
ByteRange* current_{nullptr};
};

template <>
Expand Down
2 changes: 2 additions & 0 deletions cpp/velox/tests/MemoryManagerTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ class MultiMemoryManagerTest : public ::testing::Test {
std::unordered_map<std::string, std::string> conf = {
{kMemoryReservationBlockSize, std::to_string(kMemoryReservationBlockSizeDefault)},
{kVeloxMemInitCapacity, std::to_string(kVeloxMemInitCapacityDefault)}};
std::cout << "create the velox backend" << std::endl;
gluten::VeloxBackend::create(conf);
std::cout << "created the velox backend" << std::endl;
}

std::unique_ptr<VeloxMemoryManager> newVeloxMemoryManager(std::unique_ptr<AllocationListener> listener) {
Expand Down

0 comments on commit babe70b

Please sign in to comment.