Exemplo n.º 1
0
 public MemoryTier this[Ref @ref]
 {
     get
     {
         return this[@ref.AssertNotNull().Sym];
     }
 }
Exemplo n.º 2
0
 public MemoryTier this[Ref @ref]
 {
     get
     {
         return(this[@ref.AssertNotNull().Sym]);
     }
 }
Exemplo n.º 3
0
        public Layout this[Ref @ref]
        {
            get
            {
                @ref.AssertNotNull();
                var local = @ref.Sym.AssertCast <Local>();

                return(_locals_cache.GetOrCreate(local, () =>
                {
                    var t = @ref.Type();
                    if (_scheme[@ref] == MemoryTier.Private)
                    {
                        if (t.IsArray)
                        {
                            throw AssertionHelper.Fail();
                        }
                        else
                        {
                            (t.IsCudaPrimitive() || t.IsCudaVector()).AssertTrue();
                            var slot = new Reg {
                                Type = @ref.Type(), Name = @ref.Sym.Name
                            };
                            return new SlotLayout(@ref, slot);
                        }
                    }
                    else if (_scheme[@ref] == MemoryTier.Shared)
                    {
                        if (t.IsArray)
                        {
                            throw AssertionHelper.Fail();
                        }
                        else
                        {
                            throw AssertionHelper.Fail();
                        }
                    }
                    else if (_scheme[@ref] == MemoryTier.Global)
                    {
                        if (t.IsArray)
                        {
                            throw AssertionHelper.Fail();
                        }
                        else
                        {
                            throw AssertionHelper.Fail();
                        }
                    }
                    else
                    {
                        throw AssertionHelper.Fail();
                    }
                }));
            }
        }
Exemplo n.º 4
0
        public Layout this[Ref @ref]
        {
            get
            {
                @ref.AssertNotNull();
                var local = @ref.Sym.AssertCast<Local>();

                return _locals_cache.GetOrCreate(local, () =>
                {
                    var t = @ref.Type();
                    if (_scheme[@ref] == MemoryTier.Private)
                    {
                        if (t.IsArray)
                        {
                            throw AssertionHelper.Fail();
                        }
                        else
                        {
                            (t.IsCudaPrimitive() || t.IsCudaVector()).AssertTrue();
                            var slot = new Reg{Type = @ref.Type(), Name = @ref.Sym.Name};
                            return new SlotLayout(@ref, slot);
                        }
                    }
                    else if (_scheme[@ref] == MemoryTier.Shared)
                    {
                        if (t.IsArray)
                        {
                            throw AssertionHelper.Fail();
                        }
                        else
                        {
                            throw AssertionHelper.Fail();
                        }
                    }
                    else if (_scheme[@ref] == MemoryTier.Global)
                    {
                        if (t.IsArray)
                        {
                            throw AssertionHelper.Fail();
                        }
                        else
                        {
                            throw AssertionHelper.Fail();
                        }
                    }
                    else
                    {
                        throw AssertionHelper.Fail();
                    }
                });
            }
        }