Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated markv_autogen #809

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions source/comp/markv_autogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <memory>
#include <vector>
#include <unordered_map>
#include <unordered_set>

#include "spirv/1.2/spirv.h"

Expand Down
21 changes: 18 additions & 3 deletions source/comp/markv_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <map>
#include <memory>
#include <numeric>
#include <unordered_set>

#include "util/huffman_codec.h"

Expand All @@ -26,20 +27,34 @@ inline uint64_t GetMarkvNonOfTheAbove() {
return 1111111111111111111;
}

// Returns of histogram of CombineOpcodeAndNumOperands(opcode, num_operands).
std::map<uint64_t, uint32_t> GetOpcodeAndNumOperandsHist();

// Returns Huffman codecs based on a Markov chain of histograms of
// CombineOpcodeAndNumOperands(opcode, num_operands).
// Map prev_opcode -> codec.
std::map<uint32_t, std::unique_ptr<spvutils::HuffmanCodec<uint64_t>>>
GetOpcodeAndNumOperandsMarkovHuffmanCodecs();
GetOpcodeAndNumOperandsMarkovHuffmanCodecs();

// Returns Huffman codecs for literal strings.
// Map opcode -> codec.
std::map<uint32_t, std::unique_ptr<spvutils::HuffmanCodec<std::string>>>
GetLiteralStringHuffmanCodecs();
GetLiteralStringHuffmanCodecs();

// Returns Huffman codecs for single-word non-id operand slots.
// Map <opcode, operand_index> -> codec.
std::map<std::pair<uint32_t, uint32_t>,
std::unique_ptr<spvutils::HuffmanCodec<uint64_t>>>
GetNonIdWordHuffmanCodecs();

std::map<std::pair<uint32_t, uint32_t>,
// Returns Huffman codecs for id descriptors used by common operand slots.
// Map <opcode, operand_index> -> codec.
std::map<std::pair<uint32_t, uint32_t>,
std::unique_ptr<spvutils::HuffmanCodec<uint64_t>>>
GetIdDescriptorHuffmanCodecs();

// Returns a set of all descriptors which are encodable by at least one codec
// returned by GetIdDescriptorHuffmanCodecs().
std::unordered_set<uint32_t> GetDescriptorsWithCodingScheme();

#endif // LIBSPIRV_COMP_MARKV_AUTOGEN_H_
Loading