-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b7faeb
commit 6822723
Showing
11 changed files
with
56 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
#pragma once | ||
|
||
#include <luisa/ast/constant_data.h> | ||
#include <luisa/xir/value.h> | ||
|
||
namespace luisa::compute::xir { | ||
|
||
class LC_XIR_API Constant : public Value { | ||
|
||
private: | ||
luisa::vector<std::byte> _data; | ||
ConstantData _data; | ||
|
||
public: | ||
|
||
Constant() noexcept = default; | ||
explicit Constant(ConstantData data, const Name *name = nullptr) noexcept; | ||
void set_data(ConstantData data) noexcept; | ||
[[nodiscard]] auto data() const noexcept { return _data; } | ||
}; | ||
|
||
}// namespace luisa::compute::xir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <luisa/core/logging.h> | ||
#include <luisa/xir/constant.h> | ||
|
||
namespace luisa::compute::xir { | ||
|
||
Constant::Constant(ConstantData data, const Name *name) noexcept | ||
: Value{data.type(), name} { set_data(data); } | ||
|
||
void Constant::set_data(ConstantData data) noexcept { | ||
LUISA_DEBUG_ASSERT(data.type() == type(), | ||
"Constant data type mismatch: {} vs {}", | ||
data.type()->description(), | ||
type()->description()); | ||
_data = data; | ||
} | ||
|
||
}// namespace luisa::compute::xir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters