electriclilies commented on pull request #8835:
URL: https://github.com/apache/tvm/pull/8835#issuecomment-905711627


   @mbs-octoml I was doing a bit of debugging yesterday and saw that behavior 
too-- there are some cases where we try to look up a target that is LLVM CPU in 
a map but we don't find it, even though if you print the map there is a target 
with the same target string as the target we're looking for. 
   
   I discussed a bit with @junrushao1994 and he said that Target's equality / 
hashing function is just based on pointer equality because Target equality is 
actually not well defined. 
   
   So I think that there are a few possibilities for what we can do regarding 
the issue with` Map<Target, IRModule>`:
   1. Introduce equality and hashing functions for Targets based on string 
equality. This would replicate the current behavior at least and allow us to 
key into those maps.
   The intention would be to remove the hashing and equality functions 
eventually -- but I am wary of doing this because once the functions are 
introduced, people may start using them and once uses are in the codebase, it 
could be difficult to actually remove the hash and equality functions..
   
   2. Introduce a new type that is a Map<Target, IRModule>, and we pass in a 
hash function that uses string equality on the Target. This would allow us to 
replicate the current behavior (essentially keying by strings in the map) but 
wouldn't expose the hash and equality functions. 
   
   3. Wait until more of these maps are removed to do this change
   
   My preference would be option 2
   
   
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to