-
Notifications
You must be signed in to change notification settings - Fork 127
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
[WIP][SetParameters] Generalize to work for any type, rename to TypeParameterAccessors
#1331
Closed
Closed
Changes from 1 commit
Commits
Show all changes
149 commits
Select commit
Hold shift + click to select a range
1724369
Start working on changing the name of `SetParameters`
kmp5VT 0513d41
Merge commit '172436901f883cd939caf78b81ad433bcc466140' into kmp5/ref…
kmp5VT 4ac2a8f
Merge branch 'main' into kmp5/refactor/rename_setparameters
kmp5VT f78c142
Move unused files to deprecated to better
kmp5VT 80fecae
Start moving get_parameter/parameter
kmp5VT 7bda99a
Remove `set_parameter` functions from other directories
kmp5VT 9cbbcbf
Make parameter function
kmp5VT 93ec2f4
move set_parameter functions to `set_parameters.jl`
kmp5VT 070166d
format
kmp5VT 37c8eec
Merge branch 'main' into kmp5/refactor/rename_setparameters
kmp5VT 27f147a
add comment to work on `default_parameter` [no ci]
kmp5VT 96446b7
Merge branch 'kmp5/refactor/rename_setparameters' of github.com:kmp5V…
kmp5VT 01bf0f0
Rename `SetParameters` to
kmp5VT 8f9bb82
format
kmp5VT e55611f
`TypeParameterAccessor` -> `TypeParameterAccessors`
kmp5VT 611e350
Update parameters file remove get_parameters
kmp5VT fe78a5a
Update tests for get parameters
kmp5VT 023770f
Update documentation
kmp5VT e1c7e04
Fix typo
kmp5VT 403dd72
Move Position based function to Position.jl
kmp5VT 5e6c405
Create Int conversion function
kmp5VT b15169d
Use new to _datatype function for type stability
kmp5VT c7a4cad
Update get_parameters tests
kmp5VT a8b66ff
Move `parameters.jl` before `position.jl`
kmp5VT 354a07b
Move functions that depend on `Position` to `position.jl`
kmp5VT 26e0bc6
Update set_parameters test
kmp5VT ec69ce4
Move wrapped array definitions to
kmp5VT 4936d3f
Ammending to previous push
kmp5VT 8141575
Remove parenttype_position def is unecessary here
kmp5VT 65b273a
remove uncessary set_ndims call
kmp5VT 415a39d
Export is_wrapped_array and parenttype
kmp5VT 3800125
Fix some issues and dont use `Position`
kmp5VT 0987f8f
Another issue with type stability
kmp5VT e7dc057
Start defining parenttype position places
kmp5VT 09dda15
Remove exports from `Unwrap`
kmp5VT bb12557
Remove the `parenttype.jl` file because of compiling requirements
kmp5VT 49fd429
Some updates to specify_parameters (still working here)
kmp5VT 2c3e62f
Updates to base functions to make more type stable
kmp5VT 3842143
grab the name `TypeParameterAccessors` to be able to set `parenttype_…
kmp5VT 6408feb
Update wrapper type to not have stackoverflow
kmp5VT 0edd59e
Update `set_ndim` and `set_eltype`
kmp5VT 4c6e29d
format
kmp5VT abfb994
Merge branch 'main' into kmp5/refactor/rename_setparameters
kmp5VT 6bfb87d
Some convention updates in the `TypeParameterAccessor` module
kmp5VT 512ad24
Try and remove positoin when possible
kmp5VT 7348682
Remove unecessary code
kmp5VT e43f3ae
formatting
kmp5VT 3da8963
formatting of `wrappedarray`
kmp5VT 1e112cd
Remove unecessary tests
kmp5VT 1d1b141
formatting/cleanup
kmp5VT 8994541
Start updating the `Specify_parameters`
kmp5VT cf58b1a
Update `set_parameters` to be more type stable
kmp5VT eae0a4b
Tests no longer broken
kmp5VT ad96b1b
Update specify_parameters
kmp5VT 5037009
format
kmp5VT 4d50a3c
format
kmp5VT 97f28fd
Remove unecessary code and old `specify_parameters`
kmp5VT ed83acf
Update to the position based on function system
kmp5VT 9ce2045
Add interface
kmp5VT e69657f
Add interface.jl
kmp5VT 02cc6ed
Define setstoragemode for GPU. And update default parameter
kmp5VT ffa4876
Add a `UndefinedPosition` set_parameter which does nothing
kmp5VT 015f7b5
Rename undefposition -> undefinedposition
kmp5VT d1b3cce
Make axestype and alloctype parameters
kmp5VT 5f52eec
Spelling
kmp5VT dc45b4e
Move undefinedPosition set_parameter out of set_parameter.jl. And spe…
kmp5VT 061aeba
format
kmp5VT f6569cc
Move these generated functions to the correct place
kmp5VT bfbee6b
No more parenttype_position function
kmp5VT 6b6b850
Update to position(type, function) but there are some tricky circular…
kmp5VT 0bd183e
missing changes from last push in parenttype
kmp5VT 3fee6a9
format
kmp5VT b5105b1
Merge branch 'kmp5/temp_branch' into kmp5/refactor/rename_setparameters
kmp5VT 11751e0
Update from parenttype position to position
kmp5VT 6603615
More parenttype_position to position
kmp5VT 5e58e0c
Remove typeparameteraccessor file (to_unionall and unspecifyparameters)
kmp5VT 83dadb4
Add some tests to `set_eltype`
kmp5VT 2a8cd90
Fix default parameters for Dense
kmp5VT a8b4b38
Add back unspecify_parameters to get wrapper name
kmp5VT 726d9d1
Use new system to set alloctype
kmp5VT e415155
Update UnallocatedArrays tests
kmp5VT 541f349
Update default_alloctype for UnallocatedArrays
kmp5VT 6d8be2c
Comment out default parameter test for now
kmp5VT 23cb8e0
format
kmp5VT 967953a
Some missing updates to the removed file
kmp5VT d032707
Remove NDTensors. and just say using TypeParameterAccessors
kmp5VT 7db2ca5
Update SimpleTraits using calls
kmp5VT cab209f
Move before functions
kmp5VT 4f19e7a
Fix broken test
kmp5VT c06d717
Remove unecessary @generated
kmp5VT 2bff003
Update specify_parameters to be more type stable and no longer need `…
kmp5VT 66cf178
format
kmp5VT a5064f4
`unwrap_type` -> `unwrap_array_type`
kmp5VT b29e169
correct the spelling of set_parameter
kmp5VT 69a7561
Add specify_parameter with function
kmp5VT 91d0b1f
Add some comments and remove `specify_parameters`
kmp5VT 7d2e314
format
kmp5VT 07461a8
Fix typo
kmp5VT 1b0a0bd
Working on type stable `DefaultParameter` system
kmp5VT e4c56c4
Add test to specify_parameter with function in call
kmp5VT 2a5c444
Add specify_defaults test
kmp5VT 5062135
format
kmp5VT 8276521
Move the list of default parameters to `interface` Still workshopping…
kmp5VT ea4afda
Add set_parameters, where you can put arbitrary parameters and functions
kmp5VT 16e5c17
Add some context and fix the broken case where `Int` isn't wrapped in…
kmp5VT 25d09d5
Fix typo
kmp5VT 09a9dff
Remove default_parameter test and add back unspecifying parameters test
kmp5VT adbf686
Update specify_parameter system to work better
kmp5VT efb2269
format
kmp5VT 5ba9b0c
Make a `Function` based parameter function
kmp5VT bb5d3d0
Fix specify_defaults
kmp5VT 7f8ee72
use function in parameter getting function
kmp5VT 9c21426
Use alloctype over 4
kmp5VT 07e95b9
Rename file and add defaults
kmp5VT 23c81f7
Move undefined position above parameters for compiling
kmp5VT 8b6dbeb
append to previous push
kmp5VT d8a791f
Responses to Matts comments
kmp5VT 5f1c948
int -> position
kmp5VT 6864abd
Typos
kmp5VT 719a881
Add mytype for testing
kmp5VT 0ba372e
update tests
kmp5VT 9398a90
Revert to default_parameters for now
kmp5VT 92330e7
format
kmp5VT dc3a9dd
Merge branch 'main' into kmp5/refactor/rename_setparameters
kmp5VT 87bd412
Start making `parameter_function`
kmp5VT f345715
Add parameter_function for GPUArrays
kmp5VT 94bd0d2
Start fixing things
kmp5VT d1fb870
Working on other sections of the code
kmp5VT 6b83902
parameter_function -> parameter_name
kmp5VT 3e68db2
Update mytype for testing
kmp5VT 00e954b
Another update to mytype
kmp5VT 9084b24
format
kmp5VT 73f9527
Use `compat: assume_effects`
kmp5VT f1ae64f
update CUDA cu function to use all three buffers
kmp5VT ebde22d
Remove extra set_datatype function
kmp5VT d0a39e0
Migrate `datatype` to `parenttype` funciton so `TensorStorage` is `Wr…
kmp5VT 887b8bc
format
kmp5VT fc5f639
Updates for metal
kmp5VT 7465f07
Update similartype for wrapped types properly
kmp5VT 36c4e75
format
kmp5VT 4757858
Update to use buffer
kmp5VT c171f7f
Fix typo
kmp5VT b2eef5c
Some updates
kmp5VT c81e9a0
Remove parenttype definition
kmp5VT 104a157
Update ndims
kmp5VT 528142b
format
kmp5VT 75e0969
Get `TypeParameterAccessors` working for NDTensors. There arestill ma…
kmp5VT 7b315fc
Small fixes
kmp5VT 1ce0406
Changes to the typeparameter system and get working for 1.6
kmp5VT 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 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
14 changes: 14 additions & 0 deletions
14
NDTensors/src/lib/TypeParameterAccessors/src/Base/internals.jl
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,14 @@ | ||
# Relies on Julia internals | ||
@generated to_datatype(::Type{type}) where {type} = Base.unwrap_unionall(type) | ||
#to_datatype(type::DataType) = type | ||
|
||
""" | ||
parameters(type::DataType) | ||
|
||
Gets all the type parameters of the DataType `type`. | ||
""" | ||
parameters(type::DataType) = Tuple(type.parameters) | ||
|
||
@generated to_unionall(type::Type, ::Type{ref_type}) where {ref_type} = | ||
Base.rewrap_unionall(parameter(type), ref_type) | ||
@generated unspecify_parameters(::Type{type}) where {type} = Base.typename(type).wrapper |
1 change: 1 addition & 0 deletions
1
NDTensors/src/lib/TypeParameterAccessors/src/TypeParameterAccessors.jl
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 |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
# Required overloads, generic fallback | ||
position(::Type, ::Function) = UndefinedPosition() | ||
|
||
function default_parameter(type::Type, fun::Function) | ||
return error("The default parameter of function $(fun) is not defined for type $(type)") | ||
function default_parameter(type::Type, name) | ||
return error("The default parameter of $(name) is not defined for type $(type)") | ||
end | ||
|
||
UnspecifiedFunction() = nothing | ||
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. I'm guessing this should be removed. |
||
|
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 | ||||
---|---|---|---|---|---|---|
|
@@ -9,12 +9,12 @@ Position(x) = Position{x}() | |||||
|
||||||
Get a type parameter of the type `type` at the position `position`. | ||||||
""" | ||||||
parameter(type::Type, position::Position) = parameter(type, int(position)) | ||||||
parameter(type::Type, position::Position) = parameter(type, Int(position)) | ||||||
|
||||||
struct TypeParameter{P} end | ||||||
TypeParameter(x) = TypeParameter{x}() | ||||||
|
||||||
int(p::Position) = parameter(p) | ||||||
Base.Int(p::Position) = parameter(p) | ||||||
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.
Suggested change
to make sure it really outputs |
||||||
|
||||||
eachposition(type::Type) = ntuple(Position, nparameters(type)) | ||||||
|
||||||
|
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
Oops, something went wrong.
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.
What's the reasoning behind this change?