Refactor SPMD lane abstraction and add gather support
- Rename ISPMD interfaces to ISPMDLane for clarity - Add gather and mask load methods to ISPMDLane, implement for ScalarLane and WideLane - Add GetUnsafePtr() for direct pointer access - Update MathV and vector types to use new interface and gather methods - Update SPMD job interfaces and implementations to ISPMDLane - Improve hash codes, range checks, and safety checks in vector types - Update codegen templates for new interface/methods - Refactor SPMD jobs to use gather methods for efficient vectorized access
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using static Misaki.HighPerformance.Mathematics.math;
|
||||
|
||||
@@ -711,53 +711,53 @@ public struct random
|
||||
return t;
|
||||
}
|
||||
|
||||
[Conditional("ENABLE_COLLECTION_CHECKS")]
|
||||
[Conditional("MHP_ENABLE_SAFETY_CHECKS")]
|
||||
private void CheckInitState()
|
||||
{
|
||||
#if ENABLE_COLLECTION_CHECKS
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
if (state == 0)
|
||||
throw new System.ArgumentException("Seed must be non-zero");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Conditional("ENABLE_COLLECTION_CHECKS")]
|
||||
[Conditional("MHP_ENABLE_SAFETY_CHECKS")]
|
||||
private static void CheckIndexForHash(uint index)
|
||||
{
|
||||
if (index == uint.MaxValue)
|
||||
throw new System.ArgumentException("Index must not be uint.MaxValue");
|
||||
}
|
||||
|
||||
[Conditional("ENABLE_COLLECTION_CHECKS")]
|
||||
[Conditional("MHP_ENABLE_SAFETY_CHECKS")]
|
||||
private void CheckState()
|
||||
{
|
||||
#if ENABLE_COLLECTION_CHECKS
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
if(state == 0)
|
||||
throw new System.ArgumentException("Invalid state 0. Random object has not been properly initialized");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Conditional("ENABLE_COLLECTION_CHECKS")]
|
||||
[Conditional("MHP_ENABLE_SAFETY_CHECKS")]
|
||||
private void CheckNextIntMax(int max)
|
||||
{
|
||||
#if ENABLE_COLLECTION_CHECKS
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
if (max < 0)
|
||||
throw new System.ArgumentException("max must be positive");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Conditional("ENABLE_COLLECTION_CHECKS")]
|
||||
[Conditional("MHP_ENABLE_SAFETY_CHECKS")]
|
||||
private void CheckNextIntMinMax(int min, int max)
|
||||
{
|
||||
#if ENABLE_COLLECTION_CHECKS
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
if (min > max)
|
||||
throw new System.ArgumentException("min must be less than or equal to max");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Conditional("ENABLE_COLLECTION_CHECKS")]
|
||||
[Conditional("MHP_ENABLE_SAFETY_CHECKS")]
|
||||
private void CheckNextUIntMinMax(uint min, uint max)
|
||||
{
|
||||
#if ENABLE_COLLECTION_CHECKS
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
if (min > max)
|
||||
throw new System.ArgumentException("min must be less than or equal to max");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user