Skip to content

"Kompute Tensor device is null" when rebuilding tensor  #300

Open
@MiroPalmu

Description

@MiroPalmu

When creating a tensor from manager with

inline std::shared_ptr<kp::TensorT<float>> kp::Manager::tensorT<float>(const kp::Constants &data, kp::Tensor::TensorTypes tensorType = kp::Tensor::TensorTypes::eDevice)

and then calling rebuild on created tensor it will throw "Kompute Tensor device is null"

I'm not very familiar with kompute yet but it seems if in rebuild member function following branch gets executed

if (this->mPrimaryBuffer || this->mPrimaryMemory) {
        KP_LOG_DEBUG(
          "Kompute Tensor destroying existing resources before rebuild");
        this->destroy();
    }

then in allocateMemoryCreateGPUResources

if (!this->mDevice) {
        throw std::runtime_error("Kompute Tensor device is null");
    }

gets executed every time because after this->destroy() mDevice is nullptr every time. This can be seen at Tensor.cpp:548

if (this->mDevice) {
    this->mDevice = nullptr;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions