예제 #1
0
        private void UpdateBuffer(EvaluationContext context)
        {
            int  stride      = Stride.GetValue(context);
            int  sizeInBytes = stride * Count.GetValue(context);
            bool createSrv   = CreateSrv.GetValue(context);
            bool createUav   = CreateUav.GetValue(context);
            var  bufferFlags = BufferFlags.GetValue(context);

            if (sizeInBytes <= 0)
            {
                return;
            }

            if (BufferWithViews.Value == null)
            {
                BufferWithViews.Value = new BufferWithViews();
            }

            ResourceManager.Instance().SetupStructuredBuffer(sizeInBytes, stride, ref BufferWithViews.Value.Buffer);

            if (createSrv)
            {
                ResourceManager.Instance().CreateStructuredBufferSrv(BufferWithViews.Value.Buffer, ref BufferWithViews.Value.Srv);
            }

            if (createUav)
            {
                ResourceManager.Instance().CreateStructuredBufferUav(BufferWithViews.Value.Buffer, bufferFlags, ref BufferWithViews.Value.Uav);
            }
        }
예제 #2
0
 public override void Save(XmlElement layer)
 {
     layer.SetAttribute("size", Size.ToString());
     layer.SetAttribute("filter", Filter.Serialize());
     layer.SetAttribute("stride", Stride.Serialize());
     layer.SetAttribute("padding", Padding.Serialize());
     layer.SetAttribute("activation", Activation.ToString());
 }
예제 #3
0
 /// <summary>
 /// Write instruction operands into bytecode stream.
 /// </summary>
 /// <param name="writer">Bytecode writer.</param>
 public override void WriteOperands(WordWriter writer)
 {
     Execution.Write(writer);
     Destination.Write(writer);
     Source.Write(writer);
     NumElements.Write(writer);
     Stride.Write(writer);
     Event.Write(writer);
 }
예제 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = 397 ^ Shape.GetHashCode();
         hashCode = (hashCode * 397) ^ Stride.GetHashCode();
         hashCode = (hashCode * 397) ^ Offset.GetHashCode();
         return(hashCode);
     }
 }
 /// <summary>
 /// Write instruction operands into bytecode stream.
 /// </summary>
 /// <param name="writer">Bytecode writer.</param>
 public override void WriteOperands(WordWriter writer)
 {
     Pointer.Write(writer);
     Stride.Write(writer);
     ColumnMajor.Write(writer);
     if (MemoryAccess != null)
     {
         MemoryAccess.Write(writer);
     }
 }
        /// <summary>
        /// Calculate number of words to fit complete instruction bytecode.
        /// </summary>
        /// <returns>Number of words in instruction bytecode.</returns>
        public override uint GetWordCount()
        {
            uint wordCount = 0;

            wordCount += Pointer.GetWordCount();
            wordCount += Object.GetWordCount();
            wordCount += Stride.GetWordCount();
            wordCount += ColumnMajor.GetWordCount();
            wordCount += MemoryAccess?.GetWordCount() ?? 0u;
            return(wordCount);
        }
예제 #7
0
        private void UpdateBuffer(EvaluationContext context)
        {
            int stride      = Stride.GetValue(context);
            int sizeInBytes = stride * Count.GetValue(context);

            if (sizeInBytes <= 0)
            {
                return;
            }

            ResourceManager.Instance().SetupStructuredBuffer(sizeInBytes, stride, ref Buffer.Value);
        }
예제 #8
0
        /// <summary>
        /// Calculate number of words to fit complete instruction bytecode.
        /// </summary>
        /// <returns>Number of words in instruction bytecode.</returns>
        public override uint GetWordCount()
        {
            uint wordCount = 0;

            wordCount += IdResultType.GetWordCount();
            wordCount += IdResult.GetWordCount();
            wordCount += Execution.GetWordCount();
            wordCount += Destination.GetWordCount();
            wordCount += Source.GetWordCount();
            wordCount += NumElements.GetWordCount();
            wordCount += Stride.GetWordCount();
            wordCount += Event.GetWordCount();
            return(wordCount);
        }
예제 #9
0
            /// <summary>
            /// Writes the layer as XML
            /// </summary>
            /// <param name="writer">The XML writer</param>
            public void WriteTo(XmlWriter writer)
            {
                writer.WriteStartElement("convolutional-layer");
                writer.WriteAttributeString("type", Type.ToString());
                writer.WriteAttributeString("filter-width", FilterWidth.ToString());
                writer.WriteAttributeString("filter-height", FilterHeight.ToString());
                writer.WriteAttributeString("stride", Stride.ToString());
                if (Padding > 0)
                {
                    writer.WriteAttributeString("pading", Padding.ToString());
                }

                if (Data != null)
                {
                    Data.WriteTo(writer);
                }
                writer.WriteEndElement();
            }
예제 #10
0
        private void UpdateBuffer(EvaluationContext context)
        {
            int stride      = Stride.GetValue(context);
            int sizeInBytes = stride * Count.GetValue(context);

            if (sizeInBytes <= 0)
            {
                return;
            }

            var bufferDesc = new BufferDescription
            {
                Usage               = ResourceUsage.Default,
                BindFlags           = BindFlags.UnorderedAccess | BindFlags.ShaderResource,
                SizeInBytes         = sizeInBytes,
                OptionFlags         = ResourceOptionFlags.DrawIndirectArguments,
                StructureByteStride = stride
            };

            ResourceManager.Instance().SetupBuffer(bufferDesc, ref Buffer.Value);
        }
예제 #11
0
 /// <summary>
 /// Element-wise equality.
 /// </summary>
 /// <param name="other">The instance to compare to.</param>
 /// <returns>True if all elements and all array elements are equal; false otherswise.</returns>
 public bool Equals(VertexLayoutDescription other)
 {
     return(Stride.Equals(other.Stride) &&
            Util.ArrayEqualsEquatable(Elements, other.Elements) &&
            InstanceStepRate.Equals(other.InstanceStepRate));
 }
예제 #12
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns>
 public override int GetHashCode()
 {
     return(HashHelper.Combine(Stride.GetHashCode(), HashHelper.Array(Elements), InstanceStepRate.GetHashCode()));
 }
예제 #13
0
 public LongIteratorAnonymousInnerClass(SynchronizedArrayIdOrderingQueueStressTest outerInstance)
 {
     this.outerInstance = outerInstance;
     stride             = new Stride();
 }
예제 #14
0
 public override string ToString()
 {
     return(Stride.ToString() + ": " + Count.ToString() + ": " + Flags.ToString() + ": " + Types.ToString());
 }
예제 #15
0
 public override void Save(XmlElement layer)
 {
     layer.SetAttribute("filter", Filter.Serialize());
     layer.SetAttribute("stride", Stride.Serialize());
     layer.SetAttribute("pooling-type", Type.ToString());
 }
예제 #16
0
 //ncrunch: no coverage start
 public override int GetHashCode()
 {
     return(Elements.GetHashCode() ^ Stride.GetHashCode());
 }         //ncrunch: no coverage end