Skip to content

Build error with Clang #29

@roastduck

Description

@roastduck

torch::Tensor scratch = torch::empty({H, layout.sum().item<int>(), 4}, layout.dtype());

Please have a look at this line. Implicit conversion from size_t to long is treated as an error in Clang.

  /tmp/pip-install-62i124mf/torch-blocksparse/csrc/utils.cpp:115:41: error: non-constant-expression cannot be narrowed from type 'size_
t' (aka 'unsigned long') to 'long' in initializer list [-Wc++11-narrowing]
    torch::Tensor scratch = torch::empty({H, layout.sum().item<int>(), 4}, layout.dtype());
                                          ^
  /tmp/pip-install-62i124mf/torch-blocksparse/csrc/utils.cpp:115:41: note: insert an explicit cast to silence this issue
    torch::Tensor scratch = torch::empty({H, layout.sum().item<int>(), 4}, layout.dtype());
                                          ^
                                          static_cast<long>( )

Using GCC avoids the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions