- Notifications
You must be signed in to change notification settings - Fork 5.2k
Inliner: new observations (don't impact inlining for now) #53670
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
Conversation
da5d989 to d12eed8 Compare | @dotnet/jit-contrib @AndyAyersMS Please, take a look. |
AndyAyersMS left a comment
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.
Some of the inline policies that derive from the DefaultPolicy should probably also implement the new per-policy xml dumping methods (invoking the parent version, then adding their own unique entries at the end).
Previously I'd dumped the data as a separate side file; keeping it inline with the xml makes sense. It feels like there might be cleaner ways to implement all this but I'm not sure it is worth the trouble. Better to focus on what we do with the data.
| @AndyAyersMS could you please re-review?
Do you mind if I leave it as is for now, the per-policy XML stuff is not included by default if I'm currently rewriting #52708 to be based on this PR |
…-improvements-noperf
39825f9 to c2a94a2 Compare
AndyAyersMS left a comment
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.
Do you mind if I leave it as is for now, the per-policy XML stuff is not included by default
Sure, we can fix this later.
Co-authored-by: Andy Ayers <andya@microsoft.com>
| @AndyAyersMS could you please re-review, I've addressed your feedback. |
AndyAyersMS left a comment
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.
Looks good overall. Let's just make sure we get the right check for generic methods.
| A test for generics: using System; class Program { static void Main() { Console.WriteLine(GenericClass<string>.Case1(1)); Console.WriteLine(GenericClass<string>.Case2(1)); Console.WriteLine(GenericClass<long>.Case1(1)); Console.WriteLine(GenericClass<long>.Case2(1)); Console.WriteLine(NonGenericClass.Case3<int>(1)); Console.WriteLine(NonGenericClass.Case3<string>("")); } } public class GenericClass<T> { // Case1: class is a [shared] generic, method doesn't use T public static int Case1(int a) { if (a == 42) throw new Exception("hello"); // some random code to exceed ALWAYS_INLINE limit return 0; } // Case2: class is a [shared] generic, method uses T public static int Case2(int a) { if (typeof(T) == typeof(float)) throw new Exception("hello"); // some random code to exceed ALWAYS_INLINE limit return 0; } } public class NonGenericClass { // Case3: class is not generic, method is public static int Case3<T>(T a) { if (a is float) throw new Exception("hello"); // some random code to exceed ALWAYS_INLINE limit return 0; } } |
AndyAyersMS left a comment
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.
I still think the interesting case is when caller is not shared (generic or no) and callee is shared, but let's see how this plays out when you add heuristics based on these observations.
Will check that case separately too |
Extracted from #52708
Without changes which impact inlining decisions.
Empty jit diffs (as expected).