-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[NPUW] Update NPUW caching properties #31876
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
Open
smirnov-alexey
wants to merge
7
commits into
openvinotoolkit:master
Choose a base branch
from
smirnov-alexey:as/npuw_update_caching_props
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+66
−64
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3330f75
Update NPUW caching properties
smirnov-alexey 5e5d992
Add macro
smirnov-alexey 68e7da5
Fix build
smirnov-alexey ac29563
Fix clang format
smirnov-alexey e84c4d1
Merge branch 'master' into as/npuw_update_caching_props
smirnov-alexey 8895928
Merge branch 'master' into as/npuw_update_caching_props
smirnov-alexey 3f51b10
Merge branch 'master' into as/npuw_update_caching_props
smirnov-alexey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -63,6 +63,37 @@ void registerNPUWLLMOptions(OptionsDesc& desc); | |
} \ | ||
}; | ||
|
||
#define DEFINE_ANYMAP_OPT(Name, PropertyKey) \ | ||
struct Name final : OptionBase<Name, ov::AnyMap> { \ | ||
static std::string_view key() { \ | ||
return ov::intel_npu::npuw::llm::prefill_config.name(); \ | ||
} \ | ||
\ | ||
static constexpr std::string_view getTypeName() { \ | ||
return "::intel_npu::" #PropertyKey; \ | ||
} \ | ||
\ | ||
static ov::AnyMap defaultValue() { \ | ||
return {}; \ | ||
} \ | ||
\ | ||
static ov::AnyMap parse(std::string_view val) { \ | ||
return ov::npuw::s11n::stringToAnyMap(std::string(val)); \ | ||
} \ | ||
\ | ||
static std::string toString(const ov::AnyMap& val) { \ | ||
return ov::npuw::s11n::anyMapToString(val); \ | ||
} \ | ||
\ | ||
static OptionMode mode() { \ | ||
return OptionMode::RunTime; \ | ||
} \ | ||
\ | ||
static bool isPublic() { \ | ||
return false; \ | ||
} \ | ||
}; | ||
|
||
DEFINE_OPT(NPU_USE_NPUW, bool, false, use_npuw, RunTime); | ||
DEFINE_OPT(NPUW_DEVICES, std::string, "NPU,CPU", npuw::devices, RunTime); | ||
DEFINE_OPT(NPUW_SUBMODEL_DEVICE, std::string, "", npuw::submodel_device, RunTime); | ||
|
@@ -109,10 +140,16 @@ DEFINE_OPT(NPUW_LLM_SEQ_LEN_DIM, uint32_t, 2, npuw::llm::seq_len_dim, RunTime); | |
DEFINE_OPT(NPUW_LLM_MAX_PROMPT_LEN, uint32_t, 1024, npuw::llm::max_prompt_len, RunTime); | ||
DEFINE_OPT(NPUW_LLM_MIN_RESPONSE_LEN, uint32_t, 128, npuw::llm::min_response_len, RunTime); | ||
DEFINE_OPT(NPUW_LLM_OPTIMIZE_V_TENSORS, bool, true, npuw::llm::optimize_v_tensors, RunTime); | ||
DEFINE_OPT(NPUW_LLM_CACHE_ROPE, bool, true, npuw::llm::cache_rope, CompileTime); | ||
DEFINE_OPT(NPUW_LLM_CACHE_ROPE, bool, true, npuw::llm::cache_rope, RunTime); | ||
DEFINE_OPT(NPUW_LLM_PREFILL_CHUNK_SIZE, uint64_t, 1024, npuw::llm::prefill_chunk_size, RunTime); | ||
DEFINE_OPT(NPUW_LLM_SHARED_HEAD, bool, true, npuw::llm::shared_lm_head, CompileTime); | ||
DEFINE_OPT(NPUW_LLM_SHARED_HEAD, bool, true, npuw::llm::shared_lm_head, RunTime); | ||
Comment on lines
-114
to
+145
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Answered above |
||
DEFINE_OPT(NPUW_LLM_MAX_LORA_RANK, uint32_t, 32, npuw::llm::max_lora_rank, RunTime); | ||
DEFINE_ANYMAP_OPT(NPUW_LLM_PREFILL_CONFIG, npuw::llm::prefill_config); | ||
DEFINE_ANYMAP_OPT(NPUW_LLM_ADDITIONAL_PREFILL_CONFIG, npuw::llm::additional_prefill_config); | ||
DEFINE_ANYMAP_OPT(NPUW_LLM_GENERATE_CONFIG, npuw::llm::generate_config); | ||
DEFINE_ANYMAP_OPT(NPUW_LLM_ADDITIONAL_GENERATE_CONFIG, npuw::llm::additional_generate_config); | ||
DEFINE_ANYMAP_OPT(NPUW_LLM_SHARED_LM_HEAD_CONFIG, npuw::llm::shared_lm_head_config); | ||
DEFINE_ANYMAP_OPT(NPUW_LLM_ADDITIONAL_SHARED_LM_HEAD_CONFIG, npuw::llm::additional_shared_lm_head_config); | ||
|
||
namespace npuw { | ||
namespace llm { | ||
|
@@ -216,64 +253,4 @@ struct NPUW_LLM_GENERATE_HINT final : OptionBase<NPUW_LLM_GENERATE_HINT, ::intel | |
return false; | ||
} | ||
}; | ||
|
||
struct NPUW_LLM_PREFILL_CONFIG final : OptionBase<NPUW_LLM_PREFILL_CONFIG, ov::AnyMap> { | ||
static std::string_view key() { | ||
return ov::intel_npu::npuw::llm::prefill_config.name(); | ||
} | ||
|
||
static constexpr std::string_view getTypeName() { | ||
return "::intel_npu::npuw::llm::prefill_config"; | ||
} | ||
|
||
static ov::AnyMap defaultValue() { | ||
return {}; | ||
} | ||
|
||
static ov::AnyMap parse(std::string_view val) { | ||
return ov::npuw::s11n::stringToAnyMap(std::string(val)); | ||
} | ||
|
||
static std::string toString(const ov::AnyMap& val) { | ||
return ov::npuw::s11n::anyMapToString(val); | ||
} | ||
|
||
static OptionMode mode() { | ||
return OptionMode::RunTime; | ||
} | ||
|
||
static bool isPublic() { | ||
return false; | ||
} | ||
}; | ||
|
||
struct NPUW_LLM_GENERATE_CONFIG final : OptionBase<NPUW_LLM_GENERATE_CONFIG, ov::AnyMap> { | ||
static std::string_view key() { | ||
return ov::intel_npu::npuw::llm::generate_config.name(); | ||
} | ||
|
||
static constexpr std::string_view getTypeName() { | ||
return "::intel_npu::npuw::llm::generate_config"; | ||
} | ||
|
||
static ov::AnyMap defaultValue() { | ||
return {}; | ||
} | ||
|
||
static ov::AnyMap parse(std::string_view val) { | ||
return ov::npuw::s11n::stringToAnyMap(std::string(val)); | ||
} | ||
|
||
static std::string toString(const ov::AnyMap& val) { | ||
return ov::npuw::s11n::anyMapToString(val); | ||
} | ||
|
||
static OptionMode mode() { | ||
return OptionMode::RunTime; | ||
} | ||
|
||
static bool isPublic() { | ||
return false; | ||
} | ||
}; | ||
} // namespace intel_npu |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It impacts the IR that's being compiled, how it is a runtime option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of our properties are RunTime. CompileTime is used for the NPU compiler. Also caching property won't work if it's not RunTime since we would to define
isAvailable
infilteredConfig
somewhere in the plugin